js搜索下拉菜单

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DIV+CSS模拟的下拉列表框</title>
<style type="text/css">
<!--
*{margin:0px;padding:0px;border:0px;}
ul ,li {margin: 0px;padding: 0px;list-style: none;}
.xmkc {height: 28px;width: 240px;position: relative;padding: 5px;border: 1px solid #CCC;}
.xmkc .classlist {left: 5px;position: absolute;background-color: #F5FBFF;width: 156px;border: 1px solid #C9E4F4;top: 28px;font-size: 12px;line-height: 22px;padding-top: 5px;}
.xmkc .classlist li {display: inline;}
.xmkc .classlist .lis a {text-decoration: none;background-image: url();background-repeat: no-repeat;background-position: 5px 7px;height: 22px;width: 151px;float: left;padding-left: 15px;}
.xmkc  .classlist  .close  {text-decoration: none;height: 22px;width: 156px;float: left;background-color: #E7F2FA;text-align: right;border: 0px 0 0;padding-right: 10px;}
.xmkc .classlist .lis a:hover {color: #FFF;background-color: #0E9CC8;}
.xmkc .classlist .lis a:active {color: #FFF;background-color: #0D96C0;}
.wena  {font-size: 12px;color: #FF6600;background-color: #FFFFFF;border-top-width: 1px;border-right-width: 1px;border-bottom-width: 1px;border-left-width: 1px;border-top-style: solid;border-right-style: solid;border-bottom-style: solid;border-left-style: solid;border-top-color: #096A89;border-right-color: #D3ECFF;border-bottom-color: #D3ECFF;border-left-color: #096A89;padding-right: 3px;padding-left: 3px;width: 160px;line-height: 20px;height: 18px;background-image: url();background-repeat: no-repeat;background-position: 150px 5px;}
body {margin-left: 100px;margin-top: 50px;}
-->
</style>
</head>
<script type="text/javascript">
function gets_id(objName){
 if(document.getElementById){
  return eval('document.getElementById("' + objName + '")');
 }else if(document.layers){
  return eval("document.layers['" + objName +"']");
 }else{
  return eval('document.all.' + objName);
 }
}
//打开DIV层
function disp_cc()
{
 if(gets_id('hh').style.display=='none')
 {
  gets_id('hh').style.display='';
 }
 else
 {
  gets_id('hh').style.display='none';
 }
}
//赋值
function gets_value(str)
{
 gets_id('class').value=str;
 gets_id('hh').style.display='none';
}
</script>
<body>
<div class=xmkc>
  <div><input name="class" type="text" class="wena" onClick="disp_cc();" value="请选择种别"/>
  <!--假如不需要编辑功能,可在input增加readonly="readonly"属性--></div>
  <div id="hh" style="display:none" class=classlist>
    <ul>
      <!--可循环-->
      <li class=lis><a href="/" onClick="gets_value('ASP')">ASP</a></li>
      <li class=lis><a href="#" onClick="gets_value('PHP')">PHP</a></li>
      <li class=lis><a href="#" onClick="gets_value('JSP')">JSP</a></li>
    </ul>
    <span οnclick="hh.style.display='none'" class=close><a href="#">封闭</a></span>
  </div>
</div>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值