私はこのコードを持っています
<title>Welcome</title>
<head>
<script type="text/javascript">
var id = "...";
var sessionCount = 0;
var sessionText=[];
var dumper=[];
function a()
{
var i = 0;
var processor = setInterval("refresh()", 500);
}
function refresh()
{
sessioncount();
readsessions();
htmlize();
newsession();
send("some awesome test");
}
function sessioncount()
{
xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST","count", false);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("id="+id);
sessionCount = parseInt(xmlhttp.responseText);
}
function readsessions()
{
sessionText = new Array(sessionCount);
for(var i = 0; i < sessionCount; i++)
{
xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST","read?i="+i, false);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("id="+id);
sessionText[i] = xmlhttp.ResponseText;
}
}
function newsession()
{
xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST","new", false);.
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("id="+id);
}
function send(msg)
{
xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST","write", false);.
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("msg="+msg+"&id="+id);
}
function htmlize()
{
while(sessionCount > dumper.Length)
dumper.push("");
for(var i = 0; i < sessoinCount; i++)
{
dumper[i] += sessionText[i];
alert(dumper[i]);
}
}
</script>
</head>
<body bgcolor="black">
<font color="white">
<FORM>
<INPUT TYPE="button" VALUE="GO" onclick="a()">
</FORM>
しかし、ボタンをクリックしても何も起こらず、Chrome 開発者ツールは「a」が定義されていないと表示します。私は何をすべきか?