Are there any errors? If so, post the message(s) that you see.
Is the PHP file called cd.php?
Is the PHP file called cd.php?
# # "http://www.w3.org/TR/html4/loose.dtd"> # <html> # <head> # <title>Untitled Document</title> # <script type="text/javascript"> # function test1() # { # var a=document.getElementById("first").value; # var b=a.split('/'); # var c=b[0]; # var d=b[1]; # if(c!="fog") { # document.getElementById("second").value=""; # return; # } # xmlHttp=GetXmlHttpObject(); # if(xmlHttp==null) { # alert("your browser does not support ajax"); # return; # } # var url="cd.php"; # url=url+"?d="+d; # url=url+"&sid="+Math.random(); # xmlHttp.onreadystatechange=StateChanged; # xmlHttp.open("GET",url,true); # xmlHttp.send(null); # } # # function GetXmlHttpObject() # { # var xmlHttp=null; # try # { # // Firefox, Opera 8.0+, Safari # xmlHttp=new XMLHttpRequest(); # } # catch (e) # { # // Internet Explorer # try # { # xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); # } # catch (e) # { # xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); # } # } # return xmlHttp; # } # # function StateChanged() # { # if (xmlHttp.readyState==4) # { # document.getElementById("second").value=xmlHttp.responseText; # } # } # </script> # </head> # <body> # <input type="text" id="first" size="40" onkeyup="test1();"/><br><br> # <input type="text" id="second" size="40"/> # </body> # </html>
"http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <script type="text/javascript"> function test1() { var a=document.getElementById("first").value; var b=a.split('/'); var c=b[0]; var d=b[1]; if(c!="fog") { document.getElementById("second").value=""; return; } xmlHttp=GetXmlHttpObject(); if(xmlHttp==null) { alert("your browser does not support ajax"); return; } var url="cd.php"; url=url+"?d="+d; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=StateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } } function StateChanged() { if (xmlHttp.readyState==4) { document.getElementById("second").value=xmlHttp.responseText; } } </script> </head> <body> <input type="text" id="first" size="40"/> <input type="checkbox" id="third" onClick="test1()";/><br><br> <input type="text" id="second" size="40"/> </body> </html>
Comment