« 上一篇下一篇 »

html5如何实现文本框下拉选项和下拉跳转菜单

 <form action="">
 <input type="text" list="url_list" name="text" />
 <input type="submit" />
</form>
<datalist id="url_list">
 <option label="KINGJOY TRIPOD" value="http://www.cnkingjoy.com" />
 <option label="提示1" value="列表项1" />
 <option label="提示2" value="列表项2" />
 <option label="" value="列表项3" />
</datalist>

-----------

‘下拉跳转菜单

<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");//不新建
//eval("window.open('" + selObj.options[selObj.selectedIndex].value + "')");//新建窗口

if (restore) selObj.selectedIndex=0;
}
//-->
</script>

<form action="" method="get">
    <label>Language</label>
    <select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">
        <option value="http://www.cnkingjoy.com/">中文站</option>
        <option value="http://en.cnkingjoy.com/">English</option>
        <option value="http://www.kingjoy.de/">German</option>
    </select>
</form>