Home > Article > Web Front-end > How to implement an input drop-down menu in html
This time I will show you how to implement an input-enabled drop-down menu in HTML. What are the precautions for implementing an input-enabled drop-down menu in HTML? The following is a practical case. Let’s take a look. take a look.
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <?php echo ' <form name="DDForm" method="GET" action=""> <div style=" position :relative;"> <span style=" margin-left :100px;width:18px; overflow :hidden;"> <select style="width:180px;margin-left:-100px" onchange ="this.parentNode.nextSibling.value=this.value" name="hh"> <option value="汽车">汽车 </option> <option value="火车"> 火车 </option> <option value="飞机"> 飞机 </option> </select> </span><input name="box" style="width:160px;position:absolute;left:0px;"> <input value="提交" name="submit" type="submit"/> </div> </form>'; $aa=$_GET['hh']."111"; // select 下拉菜单的值 $bb=$_GET['box']."222"; // 输入框的值 echo $aa; echo "</br>"; echo $bb; // 要获得可输入下拉菜单的值,只要获得输入框的值即可。 ?> </body> </html>To get the value that can be entered into the drop-down menu, just get the value of the input box.
注意: </span><input name="box" style="width:160px;position:absolute;left:0px;">This line must be in one line and cannot be written as
</span> <input name="box" style="width:160px;position:absolute;left:0px;">After the line break, the value of the drop-down menu cannot be displayed in the input box.
You can also automatically select matching menu values based on the input content.
How to use the new units vw, vh, vmin, vmax of css3
How to use H5 WebGL implements roaming animation of 3D virtual computer room
The above is the detailed content of How to implement an input drop-down menu in html. For more information, please follow other related articles on the PHP Chinese website!