From be4f83cd2a17a0ec05f5bce50c91befaafaa6e0c Mon Sep 17 00:00:00 2001 From: jhunkeler Date: Sun, 20 Dec 2009 18:38:08 +0000 Subject: Test. git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@376 c5b2fb0a-d05d-0410-98c8-828840a80ff6 --- ajax/form_suggestions/clienthint.js | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 ajax/form_suggestions/clienthint.js (limited to 'ajax/form_suggestions/clienthint.js') diff --git a/ajax/form_suggestions/clienthint.js b/ajax/form_suggestions/clienthint.js new file mode 100644 index 0000000..408c220 --- /dev/null +++ b/ajax/form_suggestions/clienthint.js @@ -0,0 +1,45 @@ +var xmlhttp + +function showHint(str) +{ +if (str.length==0) + { + document.getElementById("txtHint").innerHTML=""; + return; + } +xmlhttp=GetXmlHttpObject(); +if (xmlhttp==null) + { + alert ("Your browser does not support XMLHTTP!"); + 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) + { + document.getElementById("txtHint").innerHTML=xmlhttp.responseText; + } +} + +function GetXmlHttpObject() +{ +if (window.XMLHttpRequest) + { + // code for IE7+, Firefox, Chrome, Opera, Safari + return new XMLHttpRequest(); + } +if (window.ActiveXObject) + { + // code for IE6, IE5 + return new ActiveXObject("Microsoft.XMLHTTP"); + } +return null; +} \ No newline at end of file -- cgit