ajax中请求的文档的url写法问题 文档一 <script language="text/javascript"> var xmlHttp
function showHint(str) { xmlHttp=GetXmlHttpObject()//创建xmlHttp实例对象的的函数被我省略了 var url="gethint.jsp"; url=url+"?q="+str; url=url+"&sid="+Math.random();//1 xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlHttp.responseText; } } </script> </head> <body> <form> First Name:<input type="text" id="txt1" onkeyup="showHint(this.value)" /> </form> <p>Suggestions: <span id="txtHint"></span></p> </body> </html> ---------------------------------------- 文档gethint.jsp <% response.expires=-1 dim a(5) a(0)="Jack" a(1)="Anna" a(2)="Brittany" a(3)="Cinderella" a(4)="Diana" a(5)="Eva" q=ucase(request.querystring("q")) if len(q)>0 then hint="" for i=0 to 5 if q=ucase(mid(a(i),1,len(q))) then if hint="" then hint=a(i) else hint=hint & " , " & a(i) end if end if next end if if hint="" then response.write("no suggestion") else response.write(hint) end if %>