首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

透过鼠标移过控制div显示

2011-12-26 
通过鼠标移过控制div显示代码:formid f runat server scriptlanguage javascript functionom

通过鼠标移过控制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 ">

热点排行