10-01
21
百分百弹窗(不会被拦截工具给拦截)
作者:Java伴侣 日期:2010-01-21
KingCMS官方网站 蓝色理想 hutia 2006-9-24 21:50:13 优点:兼容性很好,而且俺觉得不应该有什么拦截工具可以拦截下来
优点:代码非常短
缺点:必须在页面点击后才会弹出
说明:
1.为了保证页面中的 img 不会出现丑陋的边框
<style>
#link001 img { border-style:none; }
</style>
2.保证窗口只弹出一次
3.这个结构是弹窗的根本---其实只不过是个 target="_blank" 的链接而已,拦截程序要是连这个都要拦,俺也无话可说
<body>
<a href="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>
<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>
<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="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>
<!-- This is another comment -->
</div>
</a>
</body>
<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="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>
<!-- This is another comment -->
</div>
</a>
</body>
说明:
1.为了保证页面中的 img 不会出现丑陋的边框
<style>
#link001 img { border-style:none; }
</style>
2.保证窗口只弹出一次
3.这个结构是弹窗的根本---其实只不过是个 target="_blank" 的链接而已,拦截程序要是连这个都要拦,俺也无话可说
<body>
<a href="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>
<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>
评论: 0 | 引用: 0 | 查看次数: 552
发表评论