解决DIV在IE6下无法遮盖select

你对DIV浮层在IE6下无法遮盖select标签是否了解,这里和大家一起讨论一下,其实很早以前我就碰到过关于select元素的问题,但是为什么IE7和FF下DIV都可以遮住select标签,本文会为你揭秘。

栾城网站建设公司创新互联,栾城网站设计制作,有大型网站制作公司丰富经验。已为栾城上千提供企业网站建设服务。企业网站搭建\外贸网站建设要多少钱,请找那个售后服务好的栾城做网站的公司定做!

JavaScript巧解IE6 IE7 IE8兼容问题

这次讨论一下关于select元素的一个问题,其实很早以前我就碰到过关于select元素的问题,这次做网站又被问到同样的问题,就是:一般DIV浮层在IE6下无法遮盖selectaspxhome.com/search.asp?keyword=%b1%ea%c7%a9" target=_blank>标签,IE7和FF下DIV都可以遮住select标签。

列举个简单的实例阐述问题:

 
 
 
 
  1.  
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  3.  
  4.  
  5.  
  6. 无标题文档 title> </li> <li><style type="text/CSS"> </li> <li>#warp { position:absolute; top:10px; left:26px; width:200px; height:200px;}  </li> <li>.box { position:absolute; top:0; left:0; width:200px;   </li> <li> </li> <li>height:200px; background:#FDF3D9; border:1px solid #EEAC53}  </li> <li> style> </li> <li> head> </li> <li> </li> <li><body> </li> <li><DIV id="warp"> </li> <li>  <DIV class="box">dfsagdsa DIV> </li> <li> DIV> </li> <li><form id="form1" name="form1" method="post" action=""> </li> <li><label> </li> <li><select name="select" id="select"> </li> <li>  <option>测试选项 option> </li> <li>  <option>测试选项2 option> </li> <li>  <option>测试选项3 option> </li> <li> select> </li> <li> label> </li> <li> form> </li> <li> body> </li> <li> html> </li> <li> </li> </ol></pre><p> [提示:你可先修改部分代码,再按运行]</p></p><p>DIV在IE6下无法遮盖select,原因是在IE6下,浏览器将select元素视为窗口级元素,这时DIV或者其它的普通元素无论z-index设置的多高都是无法遮住select元素的。#p#</p><p><strong>网上有两种解决办法:</strong></p><p>◆当浮动层DIV出现的时候,用JS将select隐藏,当浮动层DIV消失的时候select恢复出现。这种方法早期用的比较多,这里不多介绍。</p><p>◆ 用select同级别元素:iframe标签, 然后用实际的浮动层DIV和iframe放在一起。间接的使DIV遮住了select。</p><p>正确的代码:</p><pre> <ol> <li></li> <li> </li> <li>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> </li> <li><html xmlns="http://www.w3.org/1999/xhtml"> </li> <li><head> </li> <li><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> </li> <li><title>无标题文档 title> </li> <li><style type="text/CSS"> </li> <li>#warp { position:absolute; top:10px; left:26px; width:200px; height:200px;}  </li> <li>.box { position:absolute; top:0; left:0; width:200px;   </li> <li> </li> <li>height:200px; background:#FDF3D9; border:1px solid #EEAC53}  </li> <li>.box iframe {width:400px; height:400px; z-index:-1}  </li> <li> style> </li> <li> head> </li> <li> </li> <li><body> </li> <li><DIV id="warp"> </li> <li>  <iframe frameborder="0"> iframe> </li> <li>  <DIV class="box">dfsagdsa DIV> </li> <li> DIV> </li> <li><form id="form1" name="form1" method="post" action=""> </li> <li><label> </li> <li><select name="select" id="select"> </li> <li>  <option>测试选项 option> </li> <li>  <option>测试选项2 option> </li> <li>  <option>测试选项3 option> </li> <li> select> </li> <li> label> </li> <li> form> </li> <li> body> </li> <li> html> </li> <li> </li> <li> </li> </ol></pre><p>[提示:你可先修改部分代码,再按运行]</p></p><p>【编辑推荐】</p><ol><li>深入探究IE8和IE7的24个区别</li><li>探究IE8与IE7具体功能中窗口功能按钮的变化</li><li>剖析Margin和Padding属性中四个值的先后顺序及区别</li><li>九步轻松解决IE6的各种疑难杂症</li><li>技术前沿 一段JS代码轻松解决IE6-IE8的兼容性问题</li></ol> <p> 网站题目:<a href="http://www.mswzjz.cn/qtweb/news3/160603.html">解决DIV在IE6下无法遮盖select</a> <br> 网页路径:<a href="http://www.mswzjz.cn/qtweb/news3/160603.html">http://www.mswzjz.cn/qtweb/news3/160603.html</a> </p> <p> 攀枝花网站建设、攀枝花网站运维推广公司-贝锐智能,是专注品牌与效果的网络营销公司;服务项目有等 </p> <p class="adpic"> <a href="https://www.cdcxhl.com/service/ad.html" target="_blank" class="ad">广告</a> <a href="" target="_blank" class="adimg"><img src=""></a> </p> <p class="copy"> 声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: <a href="http://www.mswzjz.cn/" target="_blank">贝锐智能</a> </p> </div> <div class="newsmorelb"> <p>贝锐智能技术为您推荐以下文章</p> <ul> <li> <a href="/qtweb/news2/160602.html">网址访问不了-其他问题</a> </li><li> <a href="/qtweb/news1/160601.html">密Oracle加密技术保护你的重要信息</a> </li><li> <a href="/qtweb/news0/160600.html">大理服务器云存储费用多少?大理服务器云存储费用的构成和各项费用的优势</a> </li><li> <a href="/qtweb/news49/160599.html">用并行查询让SQLServer加速运行</a> </li><li> <a href="/qtweb/news48/160598.html">怎么降低香港服务器的流量压力</a> </li><li> <a href="/qtweb/news47/160597.html">怎么托管服务器?(如何托管到机房工作)</a> </li><li> <a href="/qtweb/news46/160596.html">Oracle无法呈现中文</a> </li><li> <a href="/qtweb/news45/160595.html">欧洲智能服务器:高效稳定的企业网络解决方案</a> </li><li> <a href="/qtweb/news44/160594.html">数据库系统概念第五版pdf全书最全详解(数据库系统概念第五版pdf)</a> </li> </ul> </div> </div> <div class="col-lg-3 noneb"> <div class="bkright" style="margin-top: 0"> <p><a href="https://www.cdcxhl.com/news/yxxwzjs/">营销型网站建设知识</a></p> <ul> <li> <a class="text_overflow" href="/qtweb/news14/403264.html">如何查询一个数据库的最后更新时间?(查询操作一个数据库最后的时间)</a> </li><li> <a class="text_overflow" href="/qtweb/news45/523845.html">Python太难?原来是没搞懂这一点</a> </li><li> <a class="text_overflow" href="/qtweb/news47/293197.html">windowsxp不让下载怎么回事?怎么下载windowsxp</a> </li><li> <a class="text_overflow" href="/qtweb/news28/5828.html">比较Linux文件系统性能的研究(linux文件系统对比)</a> </li><li> <a class="text_overflow" href="/qtweb/news41/333041.html">二×程序员VS苦×程序员</a> </li><li> <a class="text_overflow" href="/qtweb/news14/556414.html">美国虚拟服务器租用优点有多少</a> </li><li> <a class="text_overflow" href="/qtweb/news14/551614.html">Linux服务器中文乱码怎么解决</a> </li><li> <a class="text_overflow" href="/qtweb/news9/240309.html">美国vps虚拟服务器租用</a> </li><li> <a class="text_overflow" href="/qtweb/news29/85879.html">抖音发布技巧有哪些</a> </li><li> <a class="text_overflow" href="/qtweb/news26/555626.html">怎么连接云服务器?100万连接云服务器</a> </li><li> <a class="text_overflow" href="/qtweb/news34/362684.html">域名实名认证怎么做,哪里买域名不需要实名认证</a> </li><li> <a class="text_overflow" href="/qtweb/news40/306040.html">域名备案公司更名,域名免备案</a> </li><li> <a class="text_overflow" href="/qtweb/news28/209528.html">微信微友圈,同城发布便民信息的,怎么注册,要不要钱?(网站怎么免费注册微信账号)</a> </li><li> <a class="text_overflow" href="/qtweb/news45/84295.html">C#枚举类型的使用浅析</a> </li><li> <a class="text_overflow" href="/qtweb/news11/177161.html">香港不限流量vps怎么购买流量包</a> </li> </ul> </div> <div class="bkright tag"> <p><a href="https://www.cdcxhl.com/hangye/" target="_blank">分类信息网站</a></p> <ul> <li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/fwjd/" target="_blank">房屋鉴定</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/gaokongche/" target="_blank">高空作业车租赁</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/hldzj/" target="_blank">护栏打桩机</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/jiudiansj/" target="_blank">酒店设计</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/qzgqb/" target="_blank">轻质隔墙板</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/xiaoguotu/" target="_blank">效果图设计</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/hgdsj/" target="_blank">火锅店设计</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/shayanfudiao/" target="_blank">砂岩浮雕</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/zaomaoji/" target="_blank">凿毛机</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/loutihulan/" target="_blank">楼梯护栏</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/sljbc/" target="_blank">生料搅拌车</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/hntjbj/" target="_blank">混凝土搅拌机</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/snjbc/" target="_blank">水泥搅拌车</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/led/" target="_blank">LED显示屏</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/yangguangfang/" target="_blank">阳光房</a> </li><li class="col-lg-6 col-md-6 col-sm-6 col-xs-6"> <a href="https://www.cdcxhl.com/hangye/shiliangting/" target="_blank">石凉亭</a> </li> </ul> </div> </div> </div> <div class="carousel-inner linkbg" style="background: #fff"> <div class="container"> <a href="http://www.scgaoxian.com/" target="_blank">高县网站建设</a>    <a href="http://m.cdcxhl.com/" target="_blank">网站建设推广</a>    <a href="http://www.cxjianzhan.com/mobile/" target="_blank">企业手机网站建设</a>    <a href="http://www.nzjierui.cn/" target="_blank">成都柴油发电机组</a>    <a href="http://www.hzlinhua.com/" target="_blank">茶叶批发零售</a>    <a href="http://www.cdxwcx.cn/tuoguan/zigong.html" target="_blank">自贡服务器托管</a>    <a href="https://www.cdxwcx.com/wangzhan/applet.html" target="_blank">微信小程序开发</a>    <a href="http://www.4006tel.net/vision/" target="_blank">交互设计</a>    <a href="http://seo.cdkjz.cn/" target="_blank">网络推广</a>    <a href="http://www.cdhuace.com/zhangui.html" target="_blank">成都展柜定制</a>    <a href="https://www.cdxwcx.com/tuiguang/zhenghe.html" target="_blank">网络整合营销</a>    <a href="http://www.lhwzsj.com/" target="_blank">传美奇电器</a>    <a href="https://www.cdcxhl.cn/ " target="_blank">腾讯云免备案主机</a>    <a href="http://www.sczjjy.com/" target="_blank">四川中建建业</a>    <a href="http://www.cxjianzhan.com/" target="_blank">做网站</a>    <a href="https://www.cdxwcx.com/wangzhan/app.html" target="_blank">成都app开发公司</a>    <a href="http://m.cdcxhl.com/" target="_blank">成都网站建设</a>    <a href="https://www.cdxwcx.com/jifang/mianyang.html" target="_blank">绵阳科技城电信IDC机房</a>    <a href="http://www.cdhuace.com/faguangzi/wbfgz.html" target="_blank">无边发光字制作</a>    <a href="http://chengdu.kswjz.com/weixin/" target="_blank">微信营销</a>     </div> </div> <footer> <div class="carousel-inner footjz"> <div class="container"> <i class="icon iconfont zbw"></i> 品质网站制作 <i class="icon iconfont"></i> 自适应网站 <i class="icon iconfont"></i> 开发成本低 <i class="icon iconfont"></i> 响应速度快 <i class="icon iconfont"></i> 多人服务好 <button type="button" class="btn btn-default btn-lg" onClick="window.location.href='tencent://message/?uin=631063699&Site=&Menu=yes'"> 立即开始600网站建设</button> <button type="button" class="btn btn-default btn-xs" onClick="window.location.href='tencent://message/?uin=631063699&Site=&Menu=yes'"> 600网站制作</button> </div> </div> <div class="carousel-inner bqsy"> <div class="container"> <div class="lxfs"> <h4 class="yutelnone">028-86922220 13518219792</h4> <h4 class="yutelblock"><a href="tel:02886922220">028-86922220</a> <a href="tel:13518219792">13518219792</a></h4> <a class="btn btn-default" href="tencent://message/?uin=532337155&Site=&Menu=yes" role="button">网站建设<span>QQ</span>:532337155</a> <a class="btn btn-default" href="tencent://message/?uin=631063699&Site=&Menu=yes" role="button">营销推广<span>QQ</span>:631063699</a> <a class="btn btn1 btn-default" href="mqqwpa://im/chat?chat_type=wpa&uin=532337155&version=1&src_type=web&web_src=oicqzone.com" role="button">网站制作<span>QQ</span>:532337155</a> <a class="btn btn1 btn-default" href="mqqwpa://im/chat?chat_type=wpa&uin=631063699&version=1&src_type=web&web_src=oicqzone.com" role="button">营销推广<span>QQ</span>:631063699</a> <a class="btn btn-default nonea" href="tencent://message/?uin=1683211881&Site=&Menu=yes" role="button">售后QQ:1683211881</a> <div class="dz">创新互联建站专注: <a href="http://www.mswzjz.cn/" target="_blank">攀枝花网站设计</a> <a href="http://www.mswzjz.cn/" target="_blank">攀枝花网站制作</a> <a href="http://www.mswzjz.cn/" target="_blank">攀枝花网站建设</a> <address>地址:成都太升南路288号锦天国际A幢10楼</address> </div> </div> <div class="bzdh dz"><img src="https://www.cdcxhl.com/imges/bottom_logo.png" alt="创新互联"> <p><a href="https://www.cdcxhl.com/menu.html" target="_blank">成都创新互联科技有限公司</a><br> Tel:028-86922220(7x24h)</p></div> </div> </div> </footer> </body> </html> <script> $.getJSON ("../../qtwebpic.txt", function (data) { var jsonContent = { "featured":data } var random = jsonContent.featured[Math.floor(Math.random() * jsonContent.featured.length)]; $(".adpic .adimg").attr("href",random.link) $(".adpic img").attr("src",random.pic); }) </script>