<script language="javascript">
function check1(){
if (tr1.style.display == ""){
tr1.style.display = "none";
}else{
tr1.style.display = "";
}
}
</script>
<input type="button" name="b1" onclick="check1()">
<table>
<tr id="tr1"><td>......</td><tr>
</table>

解决方案 »

  1.   

    <table><tr><td id=mytd>aaaaaaaaaaaaaaa</td></tr></table>
    <input type=button value="隐藏" onclick="showhide()">
    <script>
    function showhide()
    {
    if(mytd.style.display=="none")
    mytd.style.display="";
    else
    mytd.style.display="none";
    }
    </script>
      

  2.   

    <script>
    function disptr(){
    if(a1.style.display == "none"){
    a1.style.display = "";
    }else{
    a1.style.display = "none";
    }
    }
    </script>
    <table border="1">
    <tr><td>3345</td></tr>
    <tr id=a1><td>asdfasdf</td>
    </tr>
    <tr><td>345345</td></tr>
    </table>
    <input type="button" onclick="disptr();" value="sdfsdf">