在IE下下拉框的层级最高,可以考虑在overlib的容器里添加iframe来解决,下面代码给你参考,_plane是容器对象。
var isIE = /msie/i.test(navigator.userAgent)&&(!/opera/i.test(navigator.userAgent));
if (isIE) {
ifm = document.createElement("iframe");
var s = ifm.style;
ifm.frameBorder = 0;
if (_plane.style.height) {
s.height = _plane.style.height + parseInt(_plane.currentStyle.borderTopWidth, 10) + parseInt(_plane.currentStyle.borderBottomWidth, 10);
s.top = -parseInt(_plane.currentStyle.borderTopWidth, 10) + "px";
s.left = -parseInt(_plane.currentStyle.borderLeftWidth, 10) + "px";
s.width = parseInt(_plane.style.width, 10) + parseInt(_plane.currentStyle.borderLeftWidth, 10) + parseInt(_plane.currentStyle.borderRightWidth, 10) + "px";
}else
{
s.height = _plane.clientHeight;
s.top = "0px";
s.left = "0px";
s.width = _plane.clientWidth;
}
s.visibility = "inherit";
s.filter = "alpha(opacity=0)";
s.position = "absolute";
s.zIndex = -1;
_plane.insertAdjacentElement("afterBegin",ifm);
}
var isIE = /msie/i.test(navigator.userAgent)&&(!/opera/i.test(navigator.userAgent));
if (isIE) {
ifm = document.createElement("iframe");
var s = ifm.style;
ifm.frameBorder = 0;
if (_plane.style.height) {
s.height = _plane.style.height + parseInt(_plane.currentStyle.borderTopWidth, 10) + parseInt(_plane.currentStyle.borderBottomWidth, 10);
s.top = -parseInt(_plane.currentStyle.borderTopWidth, 10) + "px";
s.left = -parseInt(_plane.currentStyle.borderLeftWidth, 10) + "px";
s.width = parseInt(_plane.style.width, 10) + parseInt(_plane.currentStyle.borderLeftWidth, 10) + parseInt(_plane.currentStyle.borderRightWidth, 10) + "px";
}else
{
s.height = _plane.clientHeight;
s.top = "0px";
s.left = "0px";
s.width = _plane.clientWidth;
}
s.visibility = "inherit";
s.filter = "alpha(opacity=0)";
s.position = "absolute";
s.zIndex = -1;
_plane.insertAdjacentElement("afterBegin",ifm);
}
解决方案 »
- jquery中$(this)和this的区别
- js中 thisform.operation.value thisform.submit() thisform.range.value 都是什么意思?
- 大家帮我分析一下这段js是作什么用的
- 页面一个文本文件的链接,浏览器可否设置点击的时候出现“open”按钮
- jsp上赋值问题???在线等-------------------等等等等等等等等等等
- 怎样让滚动条总在最下面
- 急!!!!!Frame 只见函数调用的问题。
- 那里有有关javascript在netscape6下使用的资料?急!多谢!
- $.when(多ajax).done();问题
- uni.requset的data怎么作为值返回到函数
- 玩CSS和JS的大手请进!---帮忙解释一行话!
- 诚心请教图片加载的问题!!!!!急急急!!!!!
显示:style="display:block"
if (ns4) {
var lyr = document.overDiv.document
lyr.write(txt)
lyr.close()
}
else if (ie4) document.all["overDiv"].innerHTML = txt
if (tr) { trk(); }}
这个函数的话
在后面添加
var isIE = /msie/i.test(navigator.userAgent)&&(!/opera/i.test(navigator.userAgent));
if (isIE) {
var _plane=document.overDiv;
ifm = document.createElement("iframe");
var s = ifm.style;
ifm.frameBorder = 0;
if (_plane.style.height) { s.height = _plane.style.height + parseInt(_plane.currentStyle.borderTopWidth, 10) + parseInt(_plane.currentStyle.borderBottomWidth, 10);
s.top = -parseInt(_plane.currentStyle.borderTopWidth, 10) + "px";
s.left = -parseInt(_plane.currentStyle.borderLeftWidth, 10) + "px";
s.width = parseInt(_plane.style.width, 10) + parseInt(_plane.currentStyle.borderLeftWidth, 10) + parseInt(_plane.currentStyle.borderRightWidth, 10) + "px";
}else
{
s.height = _plane.clientHeight;
s.top = "0px";
s.left = "0px";
s.width = _plane.clientWidth;
}
s.visibility = "inherit";
s.filter = "alpha(opacity=0)";
s.position = "absolute";
s.zIndex = -1;
_plane.insertAdjacentElement("afterBegin",ifm); }
隐藏select也可以select.style.display='none'或者select.style.visibility='hidden'
function layerWrite(txt) {
txt += "\n";
if (olNs4) {
var lyr = o3_frame.document.layers['overDiv'].document
lyr.write(txt)
lyr.close()
}
else if (typeof over.innerHTML != 'undefined') {
if (olIe5 && isMac) over.innerHTML = '';
over.innerHTML = txt;
}
else {
range = o3_frame.document.createRange();
range.setStartAfter(over);
domfrag = range.createContextualFragment(txt);
while (over.hasChildNodes()) {
over.removeChild(over.lastChild);
}
over.appendChild(domfrag);
} var isIE =/msie/i.test(navigator.userAgent)&&(!/opera/i.test(navigator.userAgent));
if (isIE) {
var _plane = document.overDiv;
ifm = document.createElement("iframe"); 1
var s = ifm.style;
ifm.frameBorder = 0;
if (_plane.style.height){
s.height = _plane.style.height + parseInt(_plane.currentStyle.borderTopWidth, 10) + parseInt(_plane.currentStyle.borderBottomWidth, 10);
s.top = -parseInt(_plane.currentStyle.borderTopWidth, 10) + "px";
s.left = -parseInt(_plane.currentStyle.borderLeftWidth, 10) + "px";
s.width = parseInt(_plane.style.width, 10) + parseInt(_plane.currentStyle.borderLeftWidth, 10) + parseInt(_plane.currentStyle.borderRightWidth, 10)+ "px";
} else {
s.height = _plane.clientHeight;
s.top = "0px";
s.left = "0px";
s.width = _plane.clientWidth;
}
s.visibility = "inherit";
s.filter = "alpha(opacity=0)";
s.position = "absolute";
s.zIndex = -1;
_plane.insertAdjacentElement("afterBegin",ifm);
}
}但是脚本执行时,会报“style为空或不是对象”的错误,这个代码我还不是很明白,不过正在理解。
另外,overlib421版在我的资源里可以下到,多谢tutu83612 !
var _plane = document.overDiv;
改为
var _plane = document.getElementById("overDiv");
就OK了
请问tutu83612:在overlib里如何设置popup的行距?