A
Angus
Hello
I am running this example from http://www.w3schools.com/ajax/ajax_server.asp
<html><body>
<script type="text/javascript">function ajaxFunction()
{ var xmlHttp;
try
{ // Firefox, Opera 8.0+, Safari xmlHttp=new
HttpRequest(); }
catch (e)
{ // Internet Explorer try
{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e)
{ try
{ xmlHttp=new
ActiveXObject("Microsoft.XMLHTTP"); }
catch (e)
{ alert("Your browser does not support AJAX!");
return
false; } } }
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open("GET","time.asp",true);
xmlHttp.send(null); }
</script>
<form name="myForm">
Name: <input type="text"
onkeyup="ajaxFunction();" name="username" />
Time: <input type="text" name="time" />
</form></body>
</html>
I have IIS setup and working fine on my PC and time.asp is like this:
<%
response.expires=-1
response.write(time)
%>
But when I try to move cursor from the textboxes I get a script error:
Line: 26
Char: 1
Error: Object expected
Code: 0
URL: http://127.0.0.1/testAjax.htm
line 26 is onkeyup="ajaxFunction();" name="username" />
Anyone any ideas on how to get this working?
Angus
I am running this example from http://www.w3schools.com/ajax/ajax_server.asp
<html><body>
<script type="text/javascript">function ajaxFunction()
{ var xmlHttp;
try
{ // Firefox, Opera 8.0+, Safari xmlHttp=new
HttpRequest(); }
catch (e)
{ // Internet Explorer try
{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e)
{ try
{ xmlHttp=new
ActiveXObject("Microsoft.XMLHTTP"); }
catch (e)
{ alert("Your browser does not support AJAX!");
return
false; } } }
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.time.value=xmlHttp.responseText;
}
}
xmlHttp.open("GET","time.asp",true);
xmlHttp.send(null); }
</script>
<form name="myForm">
Name: <input type="text"
onkeyup="ajaxFunction();" name="username" />
Time: <input type="text" name="time" />
</form></body>
</html>
I have IIS setup and working fine on my PC and time.asp is like this:
<%
response.expires=-1
response.write(time)
%>
But when I try to move cursor from the textboxes I get a script error:
Line: 26
Char: 1
Error: Object expected
Code: 0
URL: http://127.0.0.1/testAjax.htm
line 26 is onkeyup="ajaxFunction();" name="username" />
Anyone any ideas on how to get this working?
Angus