1. 程式人生 > >可輸入的下拉框,相容IE6,7,8,9

可輸入的下拉框,相容IE6,7,8,9

有時候因為包含了這一部分導致下拉框不可使用:

或者使用

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />  (IE6模擬IE8 解決這種不相容的問題)。

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>
<body>

 <style type="text/css">
 .tdSelect{}
 .tdSelect div{position: relative;}
 .tdSelect div span{margin-left:170px; width:28px;  overflow: hidden; }
 .tdSelect div span select{width: 188px; margin-left: -170px; height:119px;  }
 .tdSelect div input{height:19px;width: 170px; position: absolute; left: 0px;}
 </style>
 <table>
   <tr>
     <th>可手動輸入下拉框:</th>
     <td class ="tdSelect">
     <div>
         <span>
             <select id="UIDSelect" onchange="this.parentNode.nextSibling.value=this.value">
             <option value="001" >001</option>
             <option value="002" >002</option>
             <option value="003" >003</option>
             <option value="004" >004</option>
             </select>
         </span>
      <input type="text" name="UID" id="UID"  value='' />
     </div>
     </td>
     <td>
      <input type="button" value="隱藏的值" onclick="alert(document.getElementById('UID').value);" />
     </td>
   </tr>
 </table>

</body>
</html>