设为首页
收藏本站
本站论坛
   
3
3
   
  文章列表      

百分百的弹出窗口->>网页教学网

优点:兼容性很好,而且俺觉得不应该有什么拦截工具可以拦截下来
优点:代码非常短
缺点:必须在页面点击后才会弹出

demo:

运行代码框


<head> <style> #link001 img { border-style:none; } </style> <script> function cancelopennew(){ if(!window.event){settimeout(cancelopennewa,1000);return;} var obj=window.event.srcelement; if(!obj)return; if(!obj.tagname)return; if(string(obj.tagname).match(/input|select|option|textarea/i))return; settimeout(cancelopennewa,1000); } function cancelopennewa(){document.body.appendchild(document.getelementbyid('maindiv001'));} </script> </head> <body> <a href="/webjx/http://www.blueidea.com" target="_blank" onclick="cancelopennew();" id="link001" style="color:black; text-decoration:none; cursor:default; display:block;" hidefocus="true"> <div id="maindiv001"> <!-- this is a comment --> this is a test. <br> i try to put something here.<br> <input /> <br> <div > this is a div. </div> <ol> <li><img src="http://www.blueidea.com/articleimg/bbsimg/closedb.gif"/> and this</li> <li><img src="http://www.blueidea.com/articleimg/bbsimg/closed.gif"/> is a list</li> </ol> <form> this is a form. <input /><input type="checkbox" /> <input type="radio" name="hutia" value="1" /><input type="radio" name="hutia" value="0" /> <select><option>this is a select</option> <option>this is a select</option> </select> <textarea> and here is a textarea</textarea> <input type="button" value="button" /> <input type="submit" value="submit" /> <input type="reset" value="reset" /> </form> <iframe src="http://www.blueidea.com"></iframe> <!-- this is another comment --> </div> </a> </body>


 
 
[ctrl+a 全部选择 提示:你可先修改部分代码,再按运行]

说明:

1.为了保证页面中的 img 不会出现丑陋的边框

<style>
#link001 img { border-style:none; }
</style>

2.保证窗口只弹出一次

<script>
function cancelopennew(){
 if(!window.event){settimeout(cancelopennewa,1000);return;}
 var obj=window.event.srcelement;
 if(!obj)return;
 if(!obj.tagname)return;
 if(string(obj.tagname).match(/input|select|option|textarea/i))return;
 settimeout(cancelopennewa,1000);
}

function cancelopennewa(){document.body.appendchild(document.getelementbyid('maindiv001'));}
</script>

 

3.这个结构是弹窗的根本---其实只不过是个 target="_blank" 的链接而已,拦截程序要是连这个都要拦,俺也无话可说

<body>
<a href="/webjx/http://www.blueidea.com" target="_blank" onclick="cancelopennew();" id="link001" style="color:black; text-decoration:none; cursor:default; display:block;" hidefocus="true">
<div id="maindiv001">

4.千万不要忘记在页面结束的地方加上:

 

</div>
</a>
</body>

 
 
   
 
网上赚钱申请指南
 

友情链接
个人主页
 
 
 
 

wel come to . 欢迎光临
宇宙浪仔