<tr height="29">
    <td style="font-size:12px;color:THREEDDARKSHADOW"><input id="Checkbox1"  type="checkbox" />特殊</td>
   </tr>  <tr height="29" id="pipe"   style="display:none">
    <td CLASS="CLASS1">原因:</td>
    <td CLASS="CLASS2" colspan="3"><input name="t2" size="16" maxlength="16"></td>
   </tr>
如何写js 实现当Checkbox1选中时显示下面一行,否则不显示

解决方案 »

  1.   

    对 选中显示
     <tr height="29" id="pipe"  style="display:none"> 
        <td CLASS="CLASS1">原因: </td> 
        <td CLASS="CLASS2" colspan="3"> <input name="t2" size="16" maxlength="16"> </td> 
      </tr> 
    反之不显示
      

  2.   


    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
            <title></title>
            <script language="JavaScript" type="text/javascript">            function test(val){
                    if(document.getElementById("Checkbox1").checked){
                        document.getElementById("pipe").style.display="block"
                    }else{
                        document.getElementById("pipe").style.display="none"
                    }
                }
                window.onload=function(){
                    
                }        </script>
        </head>
        <body>
            <table>
        <tr height="29">
            <td style="font-size:12px;color:THREEDDARKSHADOW"> <input id="Checkbox1"  type="checkbox" NAME="Checkbox1" onclick="test()" /> </td>
        </tr>    <tr height="29" id="pipe"  style="display:none">
            <td CLASS="CLASS1">特殊原因: </td>
            <td CLASS="CLASS2" colspan="3"> <input name="t2" size="16" maxlength="16" ID="Text1"> </td>
        </tr>
        </table>
    </body>
    </html>
      

  3.   


    <table>
     <tr height="29"> 
        <td style="font-size:12px;color:THREEDDARKSHADOW"> <input id="Checkbox1" type="checkbox" onclick="this.checked?document.getElementById('pipe').style.display='block':document.getElementById('pipe').style.display='none'"/>特殊 </td> 
     </tr>   <tr height="29" id="pipe"  style="display:none"> 
        <td CLASS="CLASS1">原因: </td> 
        <td CLASS="CLASS2" colspan="3"> <input name="t2" size="16" maxlength="16"> </td> 
      </tr> 
    </table>