关于div盖select的简单问题!散分咯
请先看代码
<html>
<style type= "text/css ">
<!--
.aaa {
background-color: #000099;
}
.bbb {
background-color: #FFFFFF;
}
-->
</style>
</head>
<script language= "javascript ">
window.onload = loads;
//模型
function aaa()
{
window.event.srcElement.className = "aaa ";
}
function bbb()
{
window.event.srcElement.className = "bbb ";
}
//控制器
function loads()
{
var tableObj = document.getElementById( "table1 ");
var trObj = tableObj.getElementsByTagName( "tr ");
for(var i=0; i <trObj.length; i++)
{
trObj[i].onmousemove = aaa;
trObj[i].onmouseout = bbb;
}
}
</script>
<script language= "javascript ">
function clickProcess(){
divHandle=document.getElementById( 'div ');
if (divHandle.style.display == 'none '){
divHandle.style.display= 'block ';
document.all.framemask.style.display = 'block ';
}else{
divHandle.style.display= 'none ';
document.all.framemask.style.display = 'none ';
}
}
</script>
<body>
输入选项: <input type= "text "> <input type= "button " value= "…… " width=5 onClick= "clickProcess() "> <br>
<div name= "div " id= "div " style= "position:absolute;z-index:100;display:none;background-color:rgb(255,255,255) ">
<table id=table1>
<tr>
<td> 11111111111111 </td>
</tr>
<tr>
<td> 22222222222222 </td>
</tr>
<tr>
<td> 33333333333333 </td>
</tr>
<tr>
<td> 这是一个层,我想显示在select的上面 </td>
</tr>
</table>
</div>
1.
<select name= " " height=200 style= "width:200;height:200;z-index:-1; "> </select> <select name= " " height=200 style= "position:absolute;left:200px;width:200;height:200 "> </select>
2.
<iframe src= "about: " frameborder=0 id=framemask style= "position:absolute;display:none;width:300px;height:200px;left:expression(document.all( 'div ').offsetLeft);top:expression(document.all( 'div ').offsetTop);background-color:white; "> </iframe>
</body>
</html>
上述是一个div盖住select的简单方法。
在div上有一个table,有一些javascript控制鼠标移动到行的时候改变颜色。div外面就是一个iframe用来盖住select。
问题:去掉1。鼠标可以改变table行颜色
去掉2. 鼠标可以改变table行颜色,但不能盖住select
1和2同时存在,可以盖住select,但鼠标不能改变table行颜色。
问题简单,散分咯
[解决办法]
同意楼上的
[解决办法]
trObj[i].onmousemove = aaa;
trObj[i].onmouseout = bbb;
改成==>
trObj[i].onmouseover = aaa;
trObj[i].onmouseout = bbb;
试试
[解决办法]
trObj[i].onmouseover =function(){
this.className= "aaa ";
};
trObj[i].onmouseout = function(){
this.className= "bbb ";
};