I get Error "Object Expected" on line 1, char 1 (where-ever this is) on my script here in IE7. It works fine in Firefox, and the error console prints nothing.
I tried multiple ways to call my function but none works:
<a href="javascript:doit()">Turingmaschine starten</a>
<a href="#" onclick="doit()">Turingmaschine starten</a>
What could be the problem?
<script type="text/javascript" language="JavaScript">
var state;
var index;
var program;
var data;
const S=0;
const X=1;
const S2=2;
const X2=3;
const M=4;
const E="SE";
function doit()
{
state=document.getElementById("stat").value;
program = document.getElementById("prog").value.split("\n");
index = document.getElementById("dat").value.indexOf("Z")>>1;
data = document.getElementById("dat").value.replace(/Z,/, "").split(",");
for (var i = 0; i<program.length; i++)
{
program[i]=program[i].split(",");
}
while(state!=E)
{
var i;
for (i = 0; i<program.length; i++)
{
if (program[i][S]==state && program[i][X]==data[index])
{
state = program[i][S2];
data[index] = program[i][X2]
index+= parseInt(program[i][M]);
data.splice(index,0,"Z");
if (data[data.length-1]!="*")
{
data.push("*");
}
if (data[0]!="*")
{
data.unshift("*");
index++;
}
document.getElementById("out").value+=state+": "+data+"\r\n";
data.splice(index,1);
break;
}
}
if (i==program.length)
break;
}
document.getElementById("out").value+="Done.\r\n";
}
</script>