VaR XMLHTTP
Function showhint (STR)
{
If (Str. Length = 0)
{
Document. getelementbyid ("txthint"). innerhtml = ""
Return
}
XMLHTTP = getxmlhttpobject ()
If (XMLHTTP = NULL)
{
Alert ("browser does not support HTTP request ")
Return
}
VaR url = "gethint. php"
Url = URL + "? Q = "+ Str
Url = URL + "& SID =" + math. Random ()
XMLHTTP. onreadystatechange = statechanged
XMLHTTP. Open ("get", URL, true)
XMLHTTP. Send (null)
}
Function statechanged ()
{
If (XMLHTTP. readystate = 4 | XMLHTTP. readystate = "complete ")
{
Document. getelementbyid ("txthint"). innerhtml = XMLHTTP. responsetext
}
}
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;
}