当前位置:主页 > 查看内容

html 可输入下拉菜单的实现方法

发布时间:2021-05-06 00:00| 位朋友查看

简介:复制代码 代码如下: 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;overf……

复制代码
代码如下:

<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>
 

要获得可输入下拉菜单的值,只要获得输入框的值即可。

注意: </span><input name="box" style="width:160px;position:absolute;left:0px;">

这行要在一行中,不能写成

</span>

<input name="box" style="width:160px;position:absolute;left:0px;">

换行了之后则下拉菜单的值不能显示在 输入框中。

还可以根据输入的内容自动选择匹配的菜单值。

原文链接:https://m.jb51.net/web/215231.html
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!

推荐图文


随机推荐