입력 가능한 드롭다운 상자 선택

1728 단어 드롭다운 상자
쓰다
주로 원select에div를 덮어쓰고 데이터를 선택할 때div의 input에 값을 부여합니다
 



<html>
<head>
    <meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
    <title>       </title>
</head>
<body>
    <form action="" name="myform">
    <div style="position: relative;">
        <span style="margin-left: 100px; width: 18px; overflow: hidden;">
            <select style="width: 118px; margin-left: -100px" onchange="this.parentNode.nextSibling.value=this.value">
                <!--       ,    ,      
      this: <select>
      this.parentNode: <select>       <span>
      this.parentNode.nextSibling: <select>       <span>       <INPUT>
 
     alert(this.parentNode.tagName)
      alert(this.parentNode.nextSibling.tagName)
     -->
                <option value="option1">option1 </option>
                <option value="option2">option2 </option>
                <option value="option3">option3 </option>
            </select>
        </span>
        <input name="box" style="width: 100px; position: absolute; left: 0px;">
    </div>
    </br>
    <input type="button" name="submit" value="OK" onclick="alert(myform.box.value)" style="width: 100px;">
    </form>
</body>
</html>

좋은 웹페이지 즐겨찾기