Jump to content

Ajax search assistance please


crlaurence

Recommended Posts

I put together a search box that uses one of the simple suggest (like google suggest) and w3 schools suggest, but cannot figure out how to do the following1) What part of the code tells it where to look in the search string? If you dont want to limitthe typed in search request to the 1st characters of the results table, and you want it to searchfor the text anywhere in a Title.2) What parameter do you change to have it start looking after say the 2nd typed in letter insteadof the 1st?3) As the results begin to appear, if you typed in say "tool", how could the word tool be shaded adifferent color wherever it appears on each result?4) How can you display the information as part of the search box instead of in its own table?Thank you so very much for any assistance you can provide.===============var xmlHttpfunction showaz(str){if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; }xmlHttp=GetXmlHttpObject()if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; }var url="showaz2.asp";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(){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;}

Link to comment
Share on other sites

I am using .ASP instead of .PHP, and using an SQL database with a query instead of a XML doc.I am able to get the needed data, but it doesnt do the 4 items listed.I tried using some of your info, but it errors out all the time when using thisdocument.getElementById("txtHint").style.border="0px";or some other bit of info.?????

i made a response to that question in this post:AJAX search box
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...