A
akwarisk
When I try to run this web page, it says I have an error on my <Select
name="customer" onchange="showcustomer(this.value)"> line. Here is
the error I get:
Line: 57
Char: 1
Error: Object expected
Code:0
URL: http://akwarisk.brinkster.net/W3Schools/ajaxinline.html
Can anyone shed some light on what I might be doing wrong...the code
is posted below but the direct link is above.
<html>
<head>
<script type="text/javascript" language=Javascript>
var xmlHttp
function showCustomer(str){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="getcustomer.asp";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
alert("test")
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;
}
</script>
</head>
<body>
<form>
Select a customer:
<Select name="customer" onchange="showcustomer(this.value)">
<option value="ALFKI">Alfreds Futterkiste</option value>
<option value="NORTS ">North/South</option value>
<option value="WOLZA">Wolski Zajazd</option value>
</select>
</form>
<p>
<div id="txtHint"><b>Customer info will be listed here.</b></div>
</p>
</body>
</html>
name="customer" onchange="showcustomer(this.value)"> line. Here is
the error I get:
Line: 57
Char: 1
Error: Object expected
Code:0
URL: http://akwarisk.brinkster.net/W3Schools/ajaxinline.html
Can anyone shed some light on what I might be doing wrong...the code
is posted below but the direct link is above.
<html>
<head>
<script type="text/javascript" language=Javascript>
var xmlHttp
function showCustomer(str){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="getcustomer.asp";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
alert("test")
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;
}
</script>
</head>
<body>
<form>
Select a customer:
<Select name="customer" onchange="showcustomer(this.value)">
<option value="ALFKI">Alfreds Futterkiste</option value>
<option value="NORTS ">North/South</option value>
<option value="WOLZA">Wolski Zajazd</option value>
</select>
</form>
<p>
<div id="txtHint"><b>Customer info will be listed here.</b></div>
</p>
</body>
</html>