good day:
I'm using an ajax script that receives a value into an input box and thus performs a function. I need to invoke the function immediately after the input box has a value. Currently the box has to lose focus in order for the function to work.
What is the correct event handler for this to work?
I have this now
onkeyup="showResult2(this.value)"
which is obviously not what I need.
This is the ajax
<script type="text/javascript">
function showResult2(strs)
{
if (strs.length==0)
{
document.getElementById("livesearch2").innerHTML="";
document.getElementById("livesearch2").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("livesearch2").innerHTML=xmlhttp.responseText;
document.getElementById("livesearch2").style.border="1px solid #A5ACB2";
}
}
xmlhttp.open("GET","getOilChangeDate.php?q="+strs,true);
xmlhttp.send();
}
</script>
Any thoughts on this!
Mossa