<html>
<body>
<form id="form1" name="form1" method="post" action="">
   
    <tr>
      <td width="14">1</td>
      <td width="168">隐藏
        <input type="radio" name="radiobutton" value="yes" onclick="hiddentr(0)">
        显示
        <input type="radio" name="radiobutton" value="no" onclick="hiddentr(1)"></td>
    </tr>
<div id="demo">
    <tr>
      <td>2</td>
      <td><input type="text" name="textfield" /></td>
    </tr>
</div>

   
</form>
</body>
</html>
<script language="javascript">
function hiddentr(v){
var temp = document.getElementById('demo');
if(v == 0){
temp.style.display = 'none';
    }else{
temp.style.display = 'block';
}

}</script>

解决方案 »

  1.   

    <html>
    <body>
    <form id="form1" name="form1" method="post" action="">
       
        <tr>
          <td width="14">1</td>
          <td width="168">隐藏
            <input type="radio" name="radiobutton" value="yes" onclick="hiddentr()">
            显示
            <input type="radio" name="radiobutton" value="no" onclick="hiddentr()"></td>
        </tr>
    <div id="demo">
        <tr>
          <td>2</td>
          <td><input type="text" name="textfield" /></td>
        </tr>
    </div>

       
    </form>
    </body>
    </html>
    <script language="javascript">
    function hiddentr(){
    var temp = document.getElementById('demo');;
    var radiotemp = document.form1.radiobutton;
    for(var i=0;i<radiotemp.length;i++){
    if(radiotemp[i].checked == true && radiotemp[i].value == "yes" ){
    temp.style.display = 'none';
    return ;
        }else{
    temp.style.display = 'block';
    }

    }

    }</script>