zoukankan      html  css  js  c++  java
  • 自动提示的文本框

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>无标题页</title>
        <script type="text/javascript">
    function getArr(s,arrValue){
    var arrResult=new Array();
    if(s!=""){
    for(var i=0;i<arrValue.length;i++){
      if(arrValue[i].indexOf(s)==0){
         arrResult.push(arrValue[i]);
      }
    }
    }
    return arrResult;
    }
       

       
    window.onload=function (){

    document.getElementById("ww").style.display="none";

    }

    function g(){
        var aa=document.getElementById("Text1").value.toLowerCase();
        if(aa=="") return;

        var arr=["red","orange","yellow","green","blue","indigo","violet","brown","black","tan","ivory","navy","aqua","white","purple","pink","gray","silver"];
        arr.sort();

        var arrResult=getArr(aa,arr);

        var ww=document.getElementById("ww");
        ww.options.length=0;
       
        for(var i=0;i<arrResult.length;i++){
            ww.options.add(new Option(arrResult[i],arrResult[i]));
        }

        document.getElementById("ww").style.display="";
       
    }  
     
    function t(){
        document.getElementById("ww").style.display="none";
    }
        </script>
    </head>
    <body>
        <form id="form1">
        <div>
            <input id="Text1" style=" 174px" onkeyup="g();" onfocus="g();" onblur="t();" type="text" /><br />
            <select id="ww"  multiple="multiple" name="ww" style=" 180px">
            </select>
        </div>
        </form>
    </body>
    </html>

  • 相关阅读:
    Windows Server 2012 两台服务器文件同步
    Linux下非root用户运行Tomcat
    Linux离线安装mysql 5.6详细步骤
    spring再学习之整合JDBC
    spring再学习之AOP实操
    spring再学习之AOP准备
    spring再学习之注解
    spring再学习之配置详解
    spring再学习之基本概念
    spring再学习之简单测试
  • 原文地址:https://www.cnblogs.com/zhuawang/p/1264676.html
Copyright © 2011-2022 走看看