带下拉提示的输入框

 <!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>杈撳叆妗嗘彁绀哄垪琛ㄦ晥鏋?/title>
<style type="text/css">
<!--
body{background:#fff}
.Menu {
position:relative;
width:204px;
height:127px;
z-index:1;
background: #FFF;
border:1px solid #000;
margin-top:-100px;
display:none;
}
.Menu2 {
position: absolute;
left:0;
top:0;
width:100%;
height:auto;
overflow:hidden;
z-index:1;
}
.Menu2 ul{margin:0;padding:0}
.Menu2 ul li{width:100%;height:25px;line-height:25px;text-indent:15px;
             border-bottom:1px dashed #ccc;color:#666;cursor:pointer;
 change:expression(
  this.onmouseover=function(){
    this.style.background="#F2F5EF";
  },
  this.onmouseout=function(){
    this.style.background="";
  }
 )
}
input{width:200px}
.form{width:200px;height:auto;}
.form div{position:relative;top:0;left:0;margin-bottom:5px}
#List1,#List2,#List3{left:0px;top:93px;}
-->
</style>
<script type="text/javascript">
  function showAndHide(obj,types){
    var Layer=window.document.getElementById(obj);
    switch(types){
  case "show":
    Layer.style.display="block";
  break;
  case "hide":
    Layer.style.display="none";
  break;
}
  }
  function getValue(obj,str){
    var input=window.document.getElementById(obj);
input.value=str;
  }
</script>
</head>
<body>
<div class="form">
 <div> Location锛?input type="text" id="txt" name="txt" onfocus="showAndHide('List1','show');" onblur="showAndHide('List1','hide');"></div>
   <!--鍒楄〃1-->
   <div class="Menu" id="List1">
  <div class="Menu2">
    <ul >
  <li onmousedown="getValue('txt','涓浗CHINA');showAndHide('List1','hide');" style="list-style:none">涓浗CHINA</li>
  <li onmousedown="getValue('txt','缇庡浗USA');showAndHide('List1','hide');">缇庡浗USA</li>
</ul>
  </div>
   </div>
<div> Sex锛?input type="text" id="txt2" name="txt2" onfocus="showAndHide('List2','show');" onblur="showAndHide('List2','hide');"></div>
    <!--鍒楄〃2-->
   <div class="Menu" id="List2">
  <div class="Menu2">
    <ul>
  <li onmousedown="getValue('txt2','鐢稭ale');showAndHide('List2','hide');">鐢稭ale</li>
  <li onmousedown="getValue('txt2','濂矲emale');showAndHide('List2','hide');">濂矲emale</li>
</ul>
  </div>
   </div>
<div> education锛?input type="text" id="txt3" name="txt3" onfocus="showAndHide('List3','show');" onblur="showAndHide('List3','hide');"></div>
    <!--鍒楄〃3-->
   <div class="Menu" id="List3">
  <div class="Menu2">
    <ul>
  <li onmousedown="getValue('txt3',this.innerText);showAndHide('List3','hide');">澶т笓</li>
  <li onmousedown="getValue('txt3','鏈');showAndHide('List3','hide');">鏈</li>
  <li onmousedown="getValue('txt3','纭曞+');showAndHide('List3','hide');">纭曞+</li>
  <li onmousedown="getValue('txt3','鏈');showAndHide('List3','hide');">鏈</li>
</ul>
  </div>
   </div>
</div><br/>
</body>
</html>
阅读更多
个人分类: html
想对作者说点什么? 我来说一句

输入框下拉提示

2013年12月27日 115KB 下载

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭