日期:2014-05-17  浏览次数:20901 次

发布个防 ie 自动完成功能的代码
发布个防ie   自动完成功能的特效..

<!--此特效来源来互联网,由   kudaa.com   收集整理-->
<!-- <font   color=red> [精] </font> 输入框查询防IE-->
<style>
body{font-size:12px;}
td{font-size:12px}
</style>
输入 "酷达网 "   中的任意一个字就可以显示选项
<script   language= "JavaScript ">
    function   filltxt(v){
        document.getElementById( 'txtname ').value   =   v;
        rdiv.innerHTML   =   " ";
    }
    function   changeselect(txt){
        txt   =   txt.toLowerCase();
        var   results   =   0;
        rdiv.innerHTML   =   " ";
        if(txt   !=   " "){
            var   newList   =   " <table   cellpadding=2   cellspacing=0   style= 'border:1px   solid   #000000 '   bgcolor= '#ffffff '   width=100%> ";
            for(i=0;i <inpName.length;i++){
              //   var   strpart   =   inpName.options[i].value.substr(0,   txt.length) '
  var   strpart   =   inpName.options[i].value
              //   strpart   =   strpart.toLowerCase();
                if(strpart.indexOf(txt)   !=   -1){
                    results   =   results   +   1;
                    var   cellColor   =   "   onmouseover=\ "this.style.background= '#eeeeee '\ "   onmouseout=\ "this.style.background= '#ffffff '\ " ";
                    var   cellClick   =   "   onclick=\ "filltxt( ' "   +   inpName.options[i].value   +   " ')\ " ";
                    newList   +=   " <tr> <td "   +   cellColor   +   cellClick   +   "   style= 'cursor:pointer '> "   +   inpName.options[i].value   +   " </td> </tr> ";
                }
            }
            newList   +=   " </table> ";
            if(results   ==   0){
                document.getElementById( 'txtname ').style.background   =   "#ffaaaa ";
            }
            else{
                document.getElementById( 'txtname ').style.background   =   "#ffffff ";
                rdiv.innerHTML   =   newList;
            }
        }