<html> 
<head>
</head>
<body> <select name="sel" onchange="document.getElementById('txt').style.display=this.value">
<option value="block">display</option>
<option value="none">hide</option>
</select><br>
<input type="text" id="txt"><br>
</body> 
</html> 

解决方案 »

  1.   


    <select onChange="chkValue(this)"><option value="特定值">特定值<option><option value="其他值" selected>其他值<option></select>
    <span id="tt" style="display:none"><input type="text" value=""></span>
    function chkValue(obj)
    {
      if(obj.options[obj.selectedIndex].value == "特定值") document.getElementById("tt").style.display = ""
      else document.getElementById("tt").style.display = "none"
    }
      

  2.   

    <body>
    <form action='1.html' method="get" >
    <tr>
    <td>
    <select name = "select" onChange= "document.getElementById('in1').style.display = this.value">
    <option value="block">hidden</option>
      <option value="none">display</option>
    </select>
    <input type="text" id="in1" maxlength="5" >
    </td>
    </tr>
    <br>
    <tr>                                                   
    <td>                                     
    <input type="password" name="password" onkeypress='return /^[0-9a-zA-Z]{0,8}$/.test(this.value)' style = "text-transform:uppercase">
    <input type="text"  
      name="username"  
      onkeypress='return /^[0-9a-zA-Z]{0,4}$/.test(this.value)'   
      style="text-transform: uppercase">
    </td>
    </tr>
    <br>
    <tr>
    <td>
    <input type='button' name="submit" onclick="f1()">
    </td>
    </tr>
    </form>
    </body>