<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
function xx()
{
if (document.form1.select.value=="a")
{
document.getElementById("kk1").style.display = "none";
document.getElementById("kk2").style.display = "none";
document.getElementById("kk3").style.display = "none";
}
}
</script>
</head><body>
<form name="form1" id="form1" method="post" action="">
  <table width="600" border="0" align="center" cellpadding="4" cellspacing="1">
    <tr>
      <td>&nbsp;</td>
      <td><select name="select" onchange="xx()">
          <option selected="selected">选择</option>
          <option value="a">a</option>
          <option value="b">b</option>
      </select></td>
    </tr>
    <tr>
      <td>a</td>
      <td><input type="text" name="textfield" /></td>
    </tr>
    <tr>
      <td>a</td>
      <td><input type="text" name="textfield" /></td>
    </tr>
    <tr id="kk1">
      <td>b</td>
      <td><input type="text" name="textfield" /></td>
    </tr>
    <tr id="kk2">
      <td>b</td>
      <td><input type="text" name="textfield" /></td>
    </tr>
    <tr id="kk3">
      <td>b</td>
      <td><input type="text" name="textfield" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit" value="提交" />
          <input type="reset" name="Submit" value="重置" /></td>
    </tr>
  </table>
</form>
</body>
</html>
给你写了一半~选a b的全都不见~

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script>
    function xx()
    {
    if (document.form1.select.value=="a")
    {
    document.getElementById("kk1").style.display = "none";
    document.getElementById("kk2").style.display = "none";
    document.getElementById("kk3").style.display = "none";
    document.getElementById("ww1").style.display = "block";
    document.getElementById("ww2").style.display = "block";
    }
    if (document.form1.select.value=="b")
    {
    document.getElementById("kk1").style.display = "block";
    document.getElementById("kk2").style.display = "block";
    document.getElementById("kk3").style.display = "block";
    document.getElementById("ww1").style.display = "none";
    document.getElementById("ww2").style.display = "none";
    }
    }
    </script>
    </head><body>
    <form name="form1" id="form1" method="post" action="">
      <table width="600" border="0" align="center" cellpadding="4" cellspacing="1">
        <tr>
          <td>&nbsp;</td>
          <td><select name="select" onchange="xx()">
              <option selected="selected">选择</option>
              <option value="a">a</option>
              <option value="b">b</option>
          </select></td>
        </tr>
        <tr id="ww1">
          <td>a</td>
          <td><input type="text" name="textfield" /></td>
        </tr>
        <tr id="ww2">
          <td>a</td>
          <td><input type="text" name="textfield" /></td>
        </tr>
        <tr id="kk1">
          <td>b</td>
          <td><input type="text" name="textfield" /></td>
        </tr>
        <tr id="kk2">
          <td>b</td>
          <td><input type="text" name="textfield" /></td>
        </tr>
        <tr id="kk3">
          <td>b</td>
          <td><input type="text" name="textfield" /></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="Submit" value="提交" />
              <input type="reset" name="Submit" value="重置" /></td>
        </tr>
      </table>
    </form>
    </body>
    </html>