<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thoughts on Design &#187; Bug</title>
	<atom:link href="http://www.jamischarles.com/blog/tag/bug/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jamischarles.com/blog</link>
	<description>Thoughts on Web Design and Front-end Coding. Served up Monthly by Jamis Charles</description>
	<lastBuildDate>Fri, 06 Jan 2012 21:11:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>document.getElementById().innerHTML + IE7 can cause problems</title>
		<link>http://www.jamischarles.com/blog/documentgetelementbyidinnerhtml-ie7-can-cause-problems/</link>
		<comments>http://www.jamischarles.com/blog/documentgetelementbyidinnerhtml-ie7-can-cause-problems/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 13:35:01 +0000</pubDate>
		<dc:creator>jamis</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[IE7]]></category>

		<guid isPermaLink="false">http://www.bluebreeze.net/blog/?p=29</guid>
		<description><![CDATA[It seems that Firefox and IE7 can use and replace the innerHTML of a DIV just fine. However when you try it with a table or a tbody tag (among others, I&#8217;m sure), it just breaks apart miserably in IE7 (Firefox works just fine). You&#8217;ll most likely get a JavaScript error that states &#8220;Unknown runtime [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that Firefox and IE7 can use and replace the innerHTML of a DIV just fine. However when you try it with a table or a tbody tag (among others, I&#8217;m sure), it just breaks apart miserably in IE7 (Firefox works just fine). You&#8217;ll most likely get a JavaScript error that states &#8220;Unknown runtime error&#8221; and then point to the line that uses the innerHTML of the element that isn&#8217;t a DIV.</p>
<p>The solution? There are 2 possible workarounds. 1) Use a DIV, or 2) use appendChild(). I will show how to use appendChild here. I&#8217;ve tested this in IE7, FF, and Safari (Mac) and it should work. Thanks to <a href="http://domscripting.com/blog/display/99">Jeremy Keith</a> I was able to figure it out after hours of struggling.</p>
<p>The following code should probably be within a function you call.</p>
<pre class="js">&lt;script type="text/javascript"&gt;

var output = "dynamic output from earlier should go in this variable";

//first, create the table row and the table cell
var newtr = document.createElement("tr");
var newtd = document.createElement("td");

//place the output variable within the table cell, innerHTML here works because it's not on the page yet
//then, append the cell to the row, basically places the "&lt;td&gt;output here&lt;/td&gt;" tags within the &lt;tr&gt;&lt;/tr&gt; tags
newtd.innerHTML = output;
newtr.appendChild(newtd);

//last, append the whole thing to the element, here it'll find the element with the "tbody_one" id, go inside, and make it the last child
document.getElementById("tbody_one").appendChild(newtr);

&lt;/script&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.jamischarles.com/blog/documentgetelementbyidinnerhtml-ie7-can-cause-problems/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

