P
Peter
I have the following code where when user types in the txtName textbox the program retrieves list of names from a database, the problem is this occurs after every key stroke. So if I want to look for Microsoft and I type 'Mic' the program will perform 3 searches with the first one being the longest because it would retrieve all of the names starting with 'M'. What I want to be able to do is if a user types 'Mic' without pausing the computer would wait until there's a pause in typing before performing a search.
What would I have to do to make this happen, how can I create some king of timer in JScript - my JScript knowledge is limited?
Thank You
Peter
Here's my code
//////////////// C# - ASP.NET 1.1 //////////////////////////////
this.txtName.Attributes.Add("onkeyup", "return GetList();");
//////////////// JScript //////////////////////////////
function GetList()
{
try
{
obj = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
obj = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e1)
{
obj = null;
}
}
if(obj!=null)
{
document.body.style.cursor = 'wait';
obj.onreadystatechange = ProcessResponse;
obj.open("GET", "http://mywebsite.com=" + document.getElementById("txtName").value, true);
obj.send(null);
document.body.style.cursor = 'default';
}
return false;
}
What would I have to do to make this happen, how can I create some king of timer in JScript - my JScript knowledge is limited?
Thank You
Peter
Here's my code
//////////////// C# - ASP.NET 1.1 //////////////////////////////
this.txtName.Attributes.Add("onkeyup", "return GetList();");
//////////////// JScript //////////////////////////////
function GetList()
{
try
{
obj = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
obj = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e1)
{
obj = null;
}
}
if(obj!=null)
{
document.body.style.cursor = 'wait';
obj.onreadystatechange = ProcessResponse;
obj.open("GET", "http://mywebsite.com=" + document.getElementById("txtName").value, true);
obj.send(null);
document.body.style.cursor = 'default';
}
return false;
}