日期:2014-05-18  浏览次数:20431 次

通过鼠标移过控制div显示
代码:

<form   id= "f "   runat= "server ">
<script   language= "javascript ">
function   omo1()
{
document.getElementById( "tb ").style.backgroundColor= "#3ee "
document.getElementById( "d1 ").style.display= " "
document.getElementById( "d2 ").style.display= "none "
}

function   omo2()
{
document.getElementById( "tb ").style.backgroundColor= "#3ee "
document.getElementById( "d2 ").style.backgroundColor= " "
document.getElementById( "d1 ").style.backgroundColor= "none "
}
</script>
<table>
<tr>
<td   id= "tb ">
<a   href= "# "   onmouseover= "omo1() "> show1 </a>
<a   href= "# "   onmouseover= "omo2() "> show2 </a>
</td>
</tr>
<tr>
<td> <div   id= "d1 "   runat= "server "> <table>
<%for(int   a=0;a <3;a++){%>
<tr>
<td   colspan= "2 "> <%=a%> </td>
</tr>
<%}%>
</table>
</div>
</td>
</tr>
<tr>
<td> <div   id= "d2 "   runat= "server "> <table>
<%for(int   a=0;a <3;a++){%>
<tr>
<td   colspan= "2 "> <%=a+1%> </td>
</tr>
<%}%>
</table>
</div>
</td>
</tr>
</table>
</form>

报错:缺少对象
望大家帮忙解决,谢谢了先

------解决方案--------------------
document.getElementById( "d2 ").style.display= " "
=============》
document.getElementById( "d2 ").style.display= "block "
------解决方案--------------------
function omo1()
{
document.getElementById( "tb ").style.backgroundColor= "#3ee "
document.getElementById( "d1 ").style.display= "block "
document.getElementById( "d2 ").style.display= "none "
}

function omo2()
{
document.getElementById( "tb ").style.backgroundColor= "#3ee "
document.getElementById( "d2 ").style.display= "block "
document.getElementById( "d1 ").style.display= "none "
}
------解决方案--------------------
<div id= "d2 " runat= "server " style= "display:none ">