I’m trying to make a small stock quote checker. Could anyone tell me what’s wrong with this code? Thanks a whole lot in advance. ^_^
<html>
<head>
<title>Branden’s Widget</title>
<script type=”text/javascript”>
var tickersymbol = document.getElementById(“stockname”).value
var xmlhttp;
function loadXMLDoc(“
{
xmlhttp=null;
if (window.XMLHttpRequest)
{// code for all new browsers
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE5 and IE6
xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);
}
if (xmlhttp!=null)
{
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open(“GET”,url,true);
xmlhttp.send(null);
}
else
{
alert(“Your browser does not support XMLHTTP.”);
}
}
function state_Change()
{
if (xmlhttp.readyState==4)
{// 4 = “loaded”
if (xmlhttp.status==200)
{// 200 = OK
var allsourcecode=xmlhttp.responseText
var stock1=allsourcecode.split(“<span id=”)
var stock2=stock1[7].split(“>”)
var stock3=stock2[1].split(“</span>”)
var finalquotebox=document.getElementById(“finalquote”)
finalquotebox.value=tickersymbol + ” ” stock3[0]
}
else
{
alert(“Problem retrieving XML data”);
}
}
}
</script>
</head>
<body bgcolor=”black”>
<center>
<font color=”silver”><h2>Get a Stock Quote!</h2><br>
Stock: <input type=”text” id=”stockname” value=”Ticker Symbol”><input type=”submit” value=”Get Stock Quote!” onClick=”loadXMLDoc()”><br><br>
<input type=”text” id=”finalquote” value=”The Stock Quote”>
</center>
</body>
</html>