I have an html page dynamically generated by javascript with the onLoad event. This is the javascript:
function populateTable(q,a1,a2,a3,a4) {
var i;
for (i=0;i<10;i++) {
table = document.createElement("table");
table.appendChild(createQuestion(q,i));
for (var j=0;j<4;j++) {
var answer= eval("a" + (j+1));
table.appendChild(createAnswers(j,answer,i));
}
var tabform= document.getElementById("tablesform");
tabform.appendChild(table);
}
}
function createQuestion(quest,i) {
var row = document.createElement("tr");
var tabd = document.createElement("td");
tabd.setAttribute("class","question");
var qinput=document.createElement("input");
qinput.setAttribute("type","text");
qinput.setAttribute("name","q" + (i+1));
qinput.setAttribute("value",quest[i]);
qinput.setAttribute("readonly","readonly");
qinput.setAttribute("size","50");
row.appendChild(qinput);
var tabd1 = document.createElement("td");
var rdiv = document.createElement("div");
rdiv.setAttribute("id","result" + (i+1));
tabd1.appendChild(rdiv);
row.appendChild(tabd1);
return row;
}
in FF it works fine, it makes 10 neat tables, each with the question inside the text input on the first row, with all of the text input fields of the same size (50), etc etc..
on IE8 the text field remains empty, and moreover its size is not fixed! The strange thing is that if I go look at the html that was generated i see:
<FORM id=tablesform method=post action=processquiz.php>
<INPUT value=" - Correct The Test - " type=submit>
<INPUT onclick="window.location='logout.php'" value=" - Log Out - " type=button>
<TABLE>
<TR>
<INPUT value="What browser has the most DHTML extentions?" readOnly size=50 type=text name=q1>
<TD><DIV id=result1></DIV></TD>
</TR>
which is perfectly fine! What could be the problem?
EDIT: document is html 4.01 strict