to:luojx(大鱼儿)能不能具体说说原理,谢谢了!
to:zhepu(每天up多一点),我在那个网站上找了很久没找到,能不能贴到这里来

解决方案 »

  1.   

    <HTML><HEAD><TITLE>让下拉框支持输入</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <SCRIPT>
    function x956203888511( x956203888512 ) 
    { var x956203888513 = 0; 
    while ( x956203888512 != null ) { 
         x956203888513 += x956203888512.offsetLeft; 
         x956203888512 = x956203888512.offsetParent; 
    } return x956203888513; } function x956203888514( x956203888512 ) {
         var x956203888515 = 0; 
         while ( x956203888512 != null ) {
              x956203888515 += x956203888512.offsetTop; 
              x956203888512 = x956203888512.offsetParent; 
             } 
         return x956203888515; 

    function x956203888516()
      { var x956203888517=true;
       var x956203888518=navigator.appVersion;
       var x956203888519=parseInt(x956203888518.indexOf("MSIE"));
       if (x956203888519>=1) {
       var x956203888520=parseInt(x956203888518.charAt(x956203888519+5));
          if (x956203888520>=5) 
            { x956203888517=false; 
            } 
         }
          if (x956203888517) 
          { alert("This page may not be displayed properly:\n\ This product requires Microsoft Internet Explorer 5 or later browser only."); 

    } </SCRIPT><SCRIPT>x956203888516();</SCRIPT><SCRIPT>
    x956203888448 = new Array(); 
    function x956203888449(x956203888450, x956203888451) {
          this.x956203888452 = document.all[x956203888450]; 
          this.x956203888452.selectedIndex = -1; 
          this.x956203888453 = x956203888453; 
          this.x956203888454 = x956203888454; 
          this.x956203888455 = x956203888455; 
          this.x956203888456 = x956203888456; 
          this.x956203888457 = x956203888457; 
          this.x956203888458 = x956203888458; 
          this.x956203888459 = x956203888459; 
          this.x956203888460 = x956203888460; 
          this.x956203888461 = x956203888461; 
          this.x956203888462 = x956203888462; 
          this.x956203888463 = x956203888463; 
          this.x956203888464 = x956203888464; 
          this.focus = focus; 
          this.x956203888465 = x956203888465; 
          this.x956203888466 = x956203888466; 
          this.x956203888467 = x956203888467; 
          this.x956203888468 = false; 
          this.x956203888469 = false; 
          this.x956203888470 = false; 
          this.x956203888471 = false; 
          this.x956203888472 = ""; 
          var x956203888473 = x956203888450 + "_text"; 
          if (document.all[x956203888473] != null) { 
              alert("The following id: '" + x956203888473 +"' is used internally by the Combo Box!\r\n"+ "Use of this id in your page may cause malfunction. Please use another id for your controls."); } 
          var x956203888474 = "<INPUT type='text' id=" + x956203888473 + " name=" + x956203888473 + " onblur='" + x956203888451 + ".x956203888456()' " + " onkeyup='" + x956203888451 + ".x956203888462()' " + " style='display: none; position: absolute' value='' >"; 
          this.x956203888452.insertAdjacentHTML("afterEnd", x956203888474); 
          this.x956203888475 = document.all[x956203888473]; 
          var x956203888476 = x956203888450 + "_value"; 
          if (document.all[x956203888476] != null) { 
              alert("The following id: '" + x956203888476 + "' is used internally by the Combo Box!\r\n"+ "Use of this id in your page may cause malfunction. Please use another id for your controls."); } 
          var x956203888477 = "<INPUT type='hidden' "+ " id=" + x956203888476 + " name=" + x956203888476 + " >"; 
          this.x956203888452.insertAdjacentHTML("afterEnd", x956203888477); 
          this.x956203888478 = document.all[x956203888476]; 
          this.x956203888479 = false; 
          this.x956203888454(); 
          x956203888448[x956203888448.length] = this; 
        } 
        
    function x956203888457(x956203888480) { this.x956203888468 = x956203888480; } function x956203888463(x956203888481) { this.x956203888470 = x956203888481; } function x956203888464(x956203888482) { this.x956203888471 = x956203888482; } function x956203888461(x956203888483, x956203888484) { this.x956203888469 = x956203888483; var x956203888485; if (x956203888483) { if (x956203888461.arguments.length == 1) { x956203888484 = false; } var x956203888486 = this.x956203888452.options.length; var x956203888487; var x956203888488; var x956203888489; var x956203888490; var x956203888491; for (x956203888485=0; x956203888485<x956203888486; x956203888485++) { x956203888487 = x956203888485; x956203888488 = this.x956203888452.options(x956203888485).text; if (x956203888484) { x956203888488 = parseFloat(x956203888488); } for (x956203888491=x956203888485+1; x956203888491<x956203888486; x956203888491++) { x956203888490 = this.x956203888452.options(x956203888491).text; if (x956203888484) { x956203888490 = parseFloat(x956203888490); } if (x956203888488 > x956203888490) { x956203888487 = x956203888491; x956203888488 = this.x956203888452.options(x956203888491).text; } } if (x956203888485 != x956203888487) { x956203888489 = document.createElement("OPTION"); x956203888489.text = x956203888488; x956203888489.value = this.x956203888452.options(x956203888487).value; var x956203888492 = this.x956203888452.selectedIndex; this.x956203888452.options.remove(x956203888487); this.x956203888452.add(x956203888489, x956203888485); if (x956203888492 == x956203888487) { this.x956203888452.selectedIndex = x956203888485; } else if ( (x956203888492 < x956203888487) && (x956203888492 >= x956203888485) ) { this.x956203888452.selectedIndex = x956203888492 + 1; } } } } } function x956203888456() { var x956203888493 = this.x956203888452; var x956203888494 = this.x956203888475; var x956203888495 = this.x956203888478; var x956203888485; x956203888495.value = x956203888494.value; x956203888493.selectedIndex = -1; if (x956203888494.value == "") { return; } var x956203888486 = x956203888493.options.length; for (x956203888485=0; x956203888485<x956203888486; x956203888485++) { var x956203888496 = x956203888493.options(x956203888485).text; var x956203888497 = x956203888494.value; if (this.x956203888471) { x956203888496 = x956203888496.toUpperCase(); x956203888497 = x956203888497.toUpperCase(); } if (x956203888496 == x956203888497) { x956203888493.selectedIndex = x956203888485; x956203888495.value = x956203888493.options(x956203888485).value; return; } } if (this.x956203888468) { x956203888493.focus(); alert("'" + x956203888494.value + "' is not allowed"); this.x956203888452.selectedIndex = -1; this.x956203888475.select(); return; } } function x956203888465( x956203888498 ) { if ((x956203888498 == null) || (x956203888498 == "") ) { x956203888498 = this.x956203888475.value; } var x956203888486 = this.x956203888452.options.length; var x956203888485; this.x956203888475.value = x956203888498; this.x956203888475.select(); this.x956203888475.focus(); for (x956203888485=0; x956203888485<x956203888486; x956203888485++) { if (this.x956203888452.options(x956203888485).text == x956203888498) { this.x956203888452.selectedIndex = x956203888485; return; } } var x956203888489 = document.createElement("OPTION"); x956203888489.text = x956203888498; x956203888489.value = x956203888498; this.x956203888452.add(x956203888489); this.x956203888452.selectedIndex = x956203888486; if (this.x956203888469) { this.x956203888461(true); } window.resizeBy(0, -1); this.x956203888454(); window.resizeBy(0, 1); } function x956203888466( x956203888498 ) { if ((x956203888498 == null) || (x956203888498 == "") ) { x956203888498 = this.x956203888475.value; } var x956203888486 = this.x956203888452.options.length; var x956203888485; var x956203888499 = -1; for (x956203888485=0; x956203888485<x956203888486; x956203888485++) { if (this.x956203888452.options(x956203888485).text == x956203888498) { x956203888499 = x956203888485; break; } } if (x956203888499 == -1) { return; } this.x956203888452.remove(x956203888499); this.x956203888452.selectedIndex = -1; this.x956203888475.value = ""; this.x956203888454(); } function x956203888454() { if (!this.x956203888479) { this.x956203888479 = true; this.x956203888475.style.display="none"; this.x956203888452.style.position="static"; this.x956203888475.style.posLeft = x956203888511(this.x956203888452); this.x956203888475.style.posTop = x956203888514(this.x956203888452) + 1; this.x956203888475.style.posWidth = this.x956203888452.offsetWidth - 16; this.x956203888475.style.posHeight = this.x956203888452.offsetHeight; this.x956203888452.style.position ="absolute"; this.x956203888452.style.posLeft = this.x956203888475.style.posLeft; this.x956203888452.style.posTop = this.x956203888475.style.posTop; this.x956203888500 = this.x956203888452.offsetWidth; var x956203888501 = "rect(0 " + (this.x956203888452.offsetWidth) + " " + this.x956203888452.offsetHeight + " " + (this.x956203888475.style.posWidth - 2 ) + ")"; this.x956203888452.style.clip = x956203888501; this.x956203888475.style.display=""; this.x956203888479 = false; } } function x956203888455() { var x956203888502 = this.x956203888452.selectedIndex; var x956203888503 = this.x956203888452.options[x956203888502]; this.x956203888475.value = x956203888503.text; this.x956203888475.focus(); this.x956203888475.select(); this.x956203888452.selectedIndex=-1; } function x956203888453() { return this.x956203888475.value; } function x956203888467() { return this.x956203888478.value; } function x956203888459(x956203888504) { var x956203888486 = this.x956203888452.options.length; var x956203888485; for (x956203888485=0; x956203888485<x956203888486; x956203888485++) { if (this.x956203888452.options(x956203888485).text == x956203888504) { this.x956203888452.selectedIndex = x956203888485; this.x956203888475.value = this.x956203888452.options(x956203888485).text; this.x956203888478.value = this.x956203888452.options(x956203888485).value; return; } } this.x956203888452.selectedIndex = -1; this.x956203888475.value = ""; } function x956203888458(x956203888498) { var x956203888486 = this.x956203888452.options.length; var x956203888485; for (x956203888485=0; x956203888485<x956203888486; x956203888485++) { if (this.x956203888452.options(x956203888485).value == x956203888498) { this.x956203888452.selectedIndex = x956203888485; this.x956203888475.value = this.x956203888452.options(x956203888485).text; this.x956203888478.value = this.x956203888452.options(x956203888485).value; return; } } this.x956203888452.selectedIndex = -1; this.x956203888475.value = ""; } function x956203888460(x956203888485) { var x956203888486 = this.x956203888452.options.length; if ((x956203888485 >=0) && (x956203888485 < x956203888486)) { this.x956203888452.selectedIndex = x956203888485; this.x956203888475.value = this.x956203888452.options(x956203888485).text; this.x956203888478.value = this.x956203888452.options(x956203888485).value; return; } this.x956203888475.value = ""; } function x956203888462() { if (this.x956203888470) { if (event.keyCode < 32) { return; } var x956203888505 = this.x956203888475.value; var x956203888506 = this.x956203888472; var x956203888485; if ((x956203888505 == "") || (x956203888505 == x956203888506) ) { this.x956203888472 = x956203888505; return; } var x956203888486 = this.x956203888452.options.length; var x956203888507; for (x956203888485=0; x956203888485<x956203888486; x956203888485++) { x956203888507 = this.x956203888452.options(x956203888485).text; if (this.x956203888471) { x956203888507 = x956203888507.toUpperCase(); x956203888505 = x956203888505.toUpperCase(); } if (x956203888507.indexOf(x956203888505) == 0) { var x956203888508 = this.x956203888452.options(x956203888485).text; this.x956203888475.value = this.x956203888475.value + x956203888508.substr(x956203888505.length); this.x956203888452.selectedIndex = x956203888485; this.x956203888472 = this.x956203888475.value; var x956203888509 = this.x956203888475.createTextRange(); x956203888509.moveStart("character", x956203888505.length); x956203888509.select(); return; } } } } function focus() { this.x956203888475.focus(); } function x956203888510() {
         var x956203888485; 
          for (x956203888485=0; x956203888485 < x956203888448.length; x956203888485++) {
         x956203888448[x956203888485].x956203888454(); 
             } 
    }  </SCRIPT><META content="MSHTML 5.50.4522.1800" name=GENERATOR></HEAD>
    <BODY onresize=x956203888510(); onload=x956203888444();><P>请输入网址: 
    <SELECT id=tryComboBoxID onresize="if (x956203888447!=null) {x956203888447.x956203888454();}" style="POSITION: absolute" onchange="if (x956203888447!=null) {x956203888447.x956203888455();}"> 
    <OPTION value=www.51js.com selected>www.51js.com</OPTION>
    <OPTION value=www.ccbfu.com>www.ccbfu.com</OPTION> 
    <OPTION value=www.sina.com.cn>www.sina.com.cn</OPTION>
    </SELECT> 
    <BR><BR><BR>
    <INPUT id=getTryValueButtonID onclick="alert('选中的值为 \'' + x956203888447.x956203888453() + '\'');" type=button value="察看" name=retrieve> 
    </P><SCRIPT> var x956203888447; 
    function x956203888444() {
    x956203888447 = new x956203888449("tryComboBoxID", "x956203888447");
      x956203888447.x956203888460(-1); 
      x956203888447.focus();
      } </SCRIPT>
    </BODY></HTML>