不要用数字做为id开头.function showaa(obj1, obj2)
{
document.getElementById(obj1).style.display = "none";
document.getElementById(obj2).style.display = "";
}

解决方案 »

  1.   

    谢谢xie_yanke(谢烟客) ,我按照你说的修改了代码,但还是没有效果。并且按照你的方案要对多个表格进行这样的操作的话,就会比较麻烦。<html>
    <head></head>
    <body>
    <script language="javascript">
    function showaa(par, par1)
    {
    document.getElementByID(par).style.display = "";
    document.getElementByID(par1).style.display = "none";
    }</script>
    <table border="1" width="40px">
    <tr>
    <td onmouseover='showadv("aa","bb")'>显示aa</td>
    <td onmouseover='showadv("bb","aa")'>显示bb</td>
    </table>
    <table id="aa" border="1" width="200px" style="display:">
    <tr><td>这个是aa</td></tr>
    </table>
    <table id="bb" border="1" width="200px" style="Display:none">
    <tr><td>这个是bb</td></tr>
    </table>
    </body
    </html>
      

  2.   

    已经解决了!汗,不懂js语法,呵呵。getElementById写成了getElementByID了,函数名都不对。晕死!
    <html>
    <head></head>
    <body>
    <script language="javascript">
    function showadv(par)
    {
    document.getElementById("aa1").style.display = "none";
    document.getElementById("bb1").style.display = "none";
    document.getElementById(par).style.display = "";}</script>
    <table border="1" width="40px">
    <tr>
    <td onmouseover='showadv("aa1")'>显示aa</td>
    <td onmouseover='showadv("bb1")'>显示bb</td>
    </table>
    <table id="aa1" border="1" width="200px" style="display:">
    <tr><td>这个是aa</td></tr>
    </table>
    <table id="bb1" border="1" width="200px" style="Display:none">
    <tr><td>这个是bb</td></tr>
    </table>
    </body
    </html>