[Javascript] How to make IE display changes to DOM tree?
Matthew Palmer
mpalmer at hezmatt.org
Sun Dec 12 05:46:57 CST 2004
Trying to make a page dynamically add extra rows (form fields, actually) to
a page. Works wonderfully in Mozilla, refuses to do the trick in IE.
Minimalistic example:
----8<---
<html>
<head>
<script language="JavaScript">
function appendRow()
{
tbl = document.getElementById('DynamicTable');
newrow = document.createElement('TR');
newcell = document.createElement('TD');
text = document.createTextNode('Foo');
newcell.appendChild(text);
newrow.appendChild(newcell);
newcell = document.createElement('TD');
text = document.createTextNode('Bling');
newcell.appendChild(text);
newrow.appendChild(newcell);
tbl.appendChild(newrow);
}
</script>
</head>
<body>
<h1>Foo</h1>
<button onClick="appendRow()">Click me!</button>
<table name="DynamicTable" id="DynamicTable" border="1">
<tr>
<td>Here</td>
<td>There</td>
</tr>
</table>
</body>
</html>
---->8----
Does the sensible thing in Mozilla Firefox (appends a new table row for each
click), but IE doesn't show any change. Weirdest thing is, if you do a tree
dump of the DOM from the root of the table, the new nodes *are* in there --
they just never get displayed.
I'm not clueful enough to check if the newly created nodes are somehow
"display: hidden" or something, but since no example out there in the real
world shows code for unmasking these phantom elements, I don't think that's
the problem.
Can someone at least cut-n-paste the example above into a browser and tell
me if it works for them? I'm using IE 6.0.2800.1106 on Windows 98 to test.
I've tried jacking the security zone to the most trusted level, but I still
can't get it to work.
All help greatly appreciated, preferably before I tear *all* my hair out,
- Matt
--
[On LDAP] "Lightweight my ass. The fact that X.509 has the weight of an
18-wheel rig doesn't make a minivan something you shove in your backpack."
-- Zed Pobre, ASR
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20041212/65a2054a/attachment.pgp>
More information about the Javascript
mailing list