<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>请输入关键字</title>
</head>
<body>
<style>
ul,li{list-style:none;}
</style>
<script language="JavaScript">
function show(){
var val = document.getElementsByTagName("input");
var oUl = document.getElementsByTagName("ul");
if (val[0].value !=‘‘)
{
val[0].value =‘‘;
oUl[0].style.display="block";
}
}
function hide(){
var val = document.getElementsByTagName("input");
var oUl = document.getElementsByTagName("ul");
if (val[0].value ==‘‘)
{
val[0].value ="请输入关键字";
oUl[0].style.display="none";
}
}
</script>
<input value="请输入关键字"
onfocus="show()"
onblur="hide()" />
<ul style="display:none;">
<li>标题1</li>
<li>标题2</li>
<li>标题3</li>
<li>标题4</li>
</ul>
</body>
</html>
点击输入关键字 下拉列表
时间: 2024-10-11 07:18:22