<HTML>
<HEAD>
<TITLE>-51windows.Net</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Author" CONTENT="51windows,海娃,haiwa">
<META NAME="Description" CONTENT="Power by 51windows.Net">
</HEAD><BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--
var strproductinfo ="1@11|2@22|3@33|4@44"//从数据库中一次全读出来!function haiwa(strName)
{
var arrTmp = strproductinfo.split("|");
for(var i = 0; i < arrTmp.length; i++)
{
var arrTemp = arrTmp[i].split("@"); if(arrTemp[0].toUpperCase() == strName.toUpperCase()) return arrTemp[1];
}
return "";
}
//-->
</SCRIPT><INPUT TYPE="text" NAME="aa" onpropertychange="document.all.bb.value=haiwa(this.value)"><INPUT TYPE="text" NAME="bb">
</BODY>
</HTML>

解决方案 »

  1.   

    数据库太大,那就要动态读数据库了每改变一下,就在iframe中打开一个网页,把输入的值传过去!,然后在那页上返回值这样就不要用onpropertychange了,最好在旁边加个按钮,输入后,点一下再来取值!
      

  2.   

    这样也不好啊,
    不方便,
     51windows(海娃) 大哥,你会使用xmlhttp异步加载吗?
    我有位朋友告诉我用那种方法可以,但我实现不了。代码如下:
    <script language=javascript>
    function loadContent(strURL)
    {
      var strContent = "";
      if (typeof strURL != "string" || strURL == "")return;
        var xml = new ActiveXObject("Microsoft.XMLHTTP");
        xml.open("get", strURL, false);
        xml.send();
        if(xml.status==200) alert(xml.responseText);
        xml=null;
    }
    loadContent("http://www.sina.com.cn/")     //只要把“http://www.sina.com.cn”改为一个后台处理页面,并在那个页面里把商品名称写出来就行了。
    </script>帮我看看好吗?