关键字: 日历控件 被select遮挡? 不被遮挡
????? 如果网页上弹出的日历控件和下拉选单重叠时,在IE6会看到下拉选框总是把浮动区块覆盖住,无论怎么调整 z-index 都是没用的。下面为大家介绍一种不会被下拉选单遮挡的日历控件。 (日历控件请在下面下载)
一、发生情况:
二、在这种情况下日历控件展开式会被下部的? 城市 (select类型) 遮挡一部分
效果如下图:
三、我们需要的最终效果。
日历控件用法:
1.引入rl.js
<script src="js/rl.js" language="javascript" type="text/javascript"></script>
?
2.点击文本框出来日历选择层:
日期:<input type="text" id="date" onClick="SelectDate(this.name)" name="date"/>
?
3.控件引入之后还出现上"图二"的遮挡效果,解决方法:
双击打开rl.js,找到下边的代码(将注释去掉问题解决):
//if(document.all) //{ //document.write('<iframe style="position:absolute;z-index:2000;width:expression(this.previousSibling.offsetWidth);'); //document.write('height:expression(this.previousSibling.offsetHeight);'); //document.write('left:expression(this.previousSibling.offsetLeft);top:expression(this.previousSibling.offsetTop);'); //document.write('display:expression(this.previousSibling.style.display);" scrolling="no" frameborder="no"></iframe>'); //}
?
再去看看你的页面是不是问题解决了。
清风夜影寒:http://qfyyh.iteye.com
?
1 楼
liuyupy
2011-06-01
IE6 ? select&index BUG? 加入空的IFRAME
2 楼
清风夜影寒
2011-06-01
liuyupy 写道
IE6 ? select&index BUG? 加入空的IFRAME
加入和层一样大的iframe,跟层一起显隐
3 楼
vb2005xu
2011-06-01
this.divWrapper = document.createElement('div'); this.divWrapper.style['position'] = 'absolute'; this.divWrapper.style['display'] = 'none'; this.divWrapper.style['zIndex'] = '100'; this.divWrapper.style['left'] = '0px'; this.divWrapper.style['top'] = '0px'; this.template = '<div style="position:absolute;z-index: 101">' + '<a href="@{target-url}" target="_blank">' + '<img src="@{img-url}" border="0" width="@{width}" height="@{height}"/>' + '</a>' + '</div>' + '<iframe style="position:absolute;width:100%;height:100%;background:#fff;border:0;z-index: 100"></iframe>' + '<div style="position:absolute;z-index: 100"></div>'; compile: function(){ this.template = this.template.replace(/@{target-url}/g,this.target) .replace(/@{img-url}/g,this.img.src) .replace(/@{width}/g,this.img.width) .replace(/@{height}/g,this.img.height); } , // init: function(){ this.compile(); this.divWrapper.id = this.id; this.divWrapper.style['width'] = this.img.width + 'px'; this.divWrapper.style['height'] = this.img.height + 'px'; this.divWrapper.innerHTML = this.template; //将div追加到body后面 var body = document.getElementsByTagName('body')[0]; body.appendChild(this.divWrapper); } ,