解决div不能覆盖select的问题!
我写了个函数,当鼠标移动到div上,自动隐藏冲突的select,移开后在显示被隐藏的select.在onMouseOver上执行hideConflict(this),... ...
函数如下:作者阿龙,WEB开发网
http://www.webkaifa.com
function hideConflict(divCtl){
arrConflict = new Array();
hideConflictObject("SELECT",divCtl);
hideConflictObject("OBJECT",divCtl);
}
function showConflict(){
for(var i = 0;i < arrConflict.length;i ++){
arrConflict[i].style.visibility = "";
}
}
function hideConflictObject(strTagName,divCtl) {
x = divCtl.offsetLeft;
y = divCtl.offsetTop;
h = divCtl.offsetHeight;
w = divCtl.offsetWidth;
for (var i = 0; i < document.all.tags(strTagName).length; i++)
{
var obj = document.all.tags(strTagName)[i];
if (! obj || ! obj.offsetParent)
continue;
var objLeft = obj.offsetLeft;
var objTop = obj.offsetTop;
var objHeight = obj.offsetHeight;
var objWidth = obj.offsetWidth;
var objParent = obj.offsetParent;
while (objParent.tagName.toUpperCase() != "BODY"){
objLeft += objParent.offsetLeft;
objTop += objParent.offsetTop;
objParent = objParent.offsetParent;
}
var bolHide = true;
if( obj.style.display == "none" || obj.style.visibility == "hidden" || obj.getAttribute("Author") == "tiannet" ){
bolHide = false;
}
if( ( (objLeft + objWidth) > x && (y + h + 20) > objTop && (objTop+objHeight) > y && objLeft < (x+w) ) && bolHide ){
arrConflict[arrConflict.length] = obj;
obj.style.visibility = "hidden";
}
}
}