回首页 ◎ 设为首页  
◎ 收藏本站  
◎ 联系我们  
  首 页  网络资讯  教程资料  免费资源  建站指南  休闲娱乐  经典整站  访客留言  
  当前位置:首 页 >> 教程资料 >> 网页制作 >> 百分百的弹出窗口
最 新 推 荐
淘宝网店“设计装修”..推荐
网页制作常见105个问..推荐
使用FrontPage2000注..推荐
网页制作常用代码推荐
颜色代码大全推荐
热 门 排 行
北京奥运会倒计时代码
如何在网页中插入Flas..
网页自动点击广告代码
星空动态星空背景特效..
如何用Frontpage下载..
网页两侧浮动广告代码
离开时自动提示设为首页
颜色代码大全推荐
怎么使网页跳转地址栏..
站长常用广告代码的表..
淘宝网店“设计装修”..推荐
在网页上设计飘动广告
网页制作常用代码推荐
网页常用特效整理:高..
网页制作常见105个问..推荐
使用css设置iframe样式
最 近 更 新
CSS在表格边框上的美..
Flash文件中多个swf调..
圆角边框的代码
股票即时行情查询系统
万能音.视频在线转换..
仿3721窗口拖动的代码
美化的GOOGLE广告代码
修改discuz5.5,让广..
一些所谓的CSS的“顶..
中英文双语导航菜单
广 告 位 置
站 内 搜 索
关键词

搜索方式

搜索范围

精确匹配
百分百的弹出窗口

来源:盛绿设计 等级:默认等级
发布于2006-09-18 08:28 被读49次 【字体:

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

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="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>

说明:

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="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>


相关专题:暂无相关专题

上一篇:网站首页head区代码专业规范
下一篇:30余个CSS导航菜单效果

共有评论 0 条 网友评分 0分 查看全部

【发表评论】 评分:1分 2分 3分 4分 5分


Powered By Www.Xydw.COM Ver1.14 管理
Copyright © 2004-2005 盛绿设计 All Right Reserved. XCMS
冀ICP备06026128号