/    Sign up×
Community /Pin to ProfileBookmark

Unknown runtime error…

The following code works fine in NS but in IE it gives me a “Unknow runtime error”. I cant seem to find the problem though.

[CODE]<html>
<body>

<div id=”someElement”>
<table id=”myTable” border=”1″>
<tr><td>xxx</td><td>yyy</td></tr>
</table>
</div>

<script lanuage=”Javascript”>
var theHTML = “<tr><td>Hello</td><td>world</td></tr>”;
document.getElementById(“myTable”).innerHTML = theHTML;
</script>

</body>
</html>[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FangOct 06.2005 — You must built a complete table in IE using innerHTML.

Use the DOM methods if you need to add elements to a table.
Copy linkTweet thisAlerts:
@NedalsOct 06.2005 — You could do it this way instead.

I also recommend you keep your javascript in the <head> section whenever possible. It will make it much easier to read and debug down the road.

<i>
</i>&lt;html&gt;
&lt;head&gt;

&lt;script type="text/javascript"&gt;
function init() {
document.getElementById("cellA").innerHTML = 'Hello';
document.getElementById("cellB").innerHTML = 'World';
}
&lt;/script&gt;
&lt;/head&gt;

&lt;body onload="init()"&gt;

&lt;div id="someElement"&gt;
&lt;table border="1"&gt;
&lt;tr&gt;&lt;td id="cellA"&gt;xxx&lt;/td&gt;&lt;td id="cellB"&gt;yyy&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
×

Success!

Help @jmirickhai spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...