DOM problem in IE 7 but not Firefox or Opera - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

DOM problem in IE 7 but not Firefox or Opera

Josh CodeJosh Code Posts: 675Member
I'm having a problem with manipulating the Document Object Model(DOM) for Internet Explorer. The code I used works in Firefox and Opera but not in Internet Explorer 7. It failed while testing it in IE version 7.0.6000.16681.


How it fails:
The DOM changes don't show. The JavaScript completes without throwing any exceptions but in Internet Explorer, the DOM changes are not visible.

Here is the code being referred to:
[code]




var questionNum=2;

/**
Adds a question to a table by appending a new tr to that table's children
*/
function addQuestion()
{
var table = document.getElementById("questions");
var td = document.createElement("td"); // a td to contain the statement
var tr = document.createElement("tr"); // a tr to contain the td

td.appendChild(
document.createTextNode(
"Here is question "+questionNum));
tr.appendChild(td);
table.appendChild(tr);

questionNum++;

alert("question added. Do you see it?");
}











Here is question 1.


[/code]


Should something in this code be changed so it works for all browsers?

Is there a way to explicitly update or refresh the display to reveal the changes Internet Explorer seems to be hiding?

Do you have any other suggestion for clearing up this problem?
Sign In or Register to comment.