Home > Web Front-end > HTML Tutorial > How to write html input drop-down menu

How to write html input drop-down menu

php中世界最好的语言
Release: 2018-01-27 09:34:46
Original
2527 people have browsed it

This time I will bring you html inputable drop-down menu How to write, what are the precautions when writing html inputable drop-down menu, the following is a practical case, let’s take a look one time.

The code is as follows:

<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
</head> 
<body> 
<?php 
echo &#39; 
<form name="DDForm" method="GET" action=""> 
<p 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"/> 
</p> 
</form>&#39;; 
$aa=$_GET[&#39;hh&#39;]."111"; // select 下拉菜单的值 
$bb=$_GET[&#39;box&#39;]."222"; // 输入框的值 
echo $aa; 
echo "</br>"; 
echo $bb; 
// 要获得可输入下拉菜单的值,只要获得输入框的值即可。 
?> 
</body> 
</html>
Copy after login

To get the value that can be entered into the drop-down menu, just get the value of the input box.
Note:

</span><input name="box" style="width:160px;position:absolute;left:0px;">
Copy after login

This line must be in one line and cannot be written as

</span> 
<input name="box" style="width:160px;position:absolute;left:0px;">
Copy after login

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.

I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

Important properties of IE8 compatibility window and control the properties of the window

In the HTML list, what are the differences between dl(dt,dd), ul(li), and ol(li)

The above is the detailed content of How to write html input drop-down menu. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template