Hi, Here Is the code and example for how to create a live search or instant search for your website.It consist of 3 parts 1.A JavaScript including Ajax 2.A Input box to enter the keywords by user 3.A Php Code to do the searching Now , the JavaScript code is given below <script type="text/javascript"> function showResult(str) { if (str.length==0) { document.getElementById("livesearch").innerHTML=""; document.getElementById("livesearch").style.border="0px"; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("livesearch").innerHTML=xmlhttp.responseTe...
Comments
Post a Comment