[ajug-members] Slightly OT: Javascript question
Tim Watts
timtw at earthlink.net
Sun Feb 5 17:38:58 EST 2006
Hi,
Can anyone tell me how to get the following code working in IE?. This works
perfectly in Mozilla and co. All it does is adds a row to a table. On IE, the
script finds the target element but throws an error when it tries to
set .innerHTML.
Any insight will be appreciated.
<html>
<head>
<script>
numAttrs = 1;
function AddAttr() {
var elem = document.getElementById("attrTable");
++numAttrs;
elem.innerHTML +=
"<tr>" +
" <td>Attribute Name: <input type='text' name='attr" +numAttrs
+"' /></td>" +
"</tr>"
;
}
</script>
</head>
<body>
<p><a href="javascript:AddAttr()">add attribute</a></p>
<table>
<tbody id="attrTable">
<tr>
<td>Attribute Name: <input type="text" name="attr1"/></td>
</tr>
</tbody>
</table>
</body>
</html>
More information about the ajug-members
mailing list