<?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>Matt Thiessen &#187; JavaScript</title>
	<atom:link href="http://matt.thiessen.us/category/coding/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://matt.thiessen.us</link>
	<description>Learning to make the hard things easy</description>
	<lastBuildDate>Thu, 09 Feb 2012 03:45:21 +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>Deprecated innerHTML</title>
		<link>http://matt.thiessen.us/2009/02/deprecated-innerhtml/</link>
		<comments>http://matt.thiessen.us/2009/02/deprecated-innerhtml/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 19:14:08 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://matt.thiessen.us/?p=136</guid>
		<description><![CDATA[This is a JavaScript example of how to use the createTextNode instead of the deprecated innerHTML. There is also an example of how to use the removeChild function if the node you want to add to has child nodes. &#60;script type=&#34;text/javascript&#34;&#62; function redmatchJobCount() { var redmatchJobCount = &#34;&#60;?php echo(getRedmatchJobCount()); ?&#62;&#34;; // create this: &#60;span class=&#34;count&#34;&#62;309&#60;/span&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>This is a JavaScript example of how to use the createTextNode instead of the deprecated innerHTML.  There is also an example of how to use the removeChild function if the node you want to add to has child nodes.</p>
<pre class="wp-code-highlight prettyprint">&lt;script type=&quot;text/javascript&quot;&gt;

	function redmatchJobCount() {

		var redmatchJobCount = &quot;&lt;?php echo(getRedmatchJobCount()); ?&gt;&quot;;

		// create this: &lt;span class=&quot;count&quot;&gt;309&lt;/span&gt;
		var textObj1 = document.createTextNode(redmatchJobCount);
		var span1 = document.createElement(&quot;span&quot;);
		span1.className = &quot;count&quot;;
		span1.appendChild(textObj1);

		// create this: &lt;span class=&quot;jobs_online&quot;&gt;Jobs Online&lt;/span&gt;
		var textObj2 = document.createTextNode(&quot; Jobs Online&quot;);
		var span2 = document.createElement(&quot;span&quot;);
		span2.className = &quot;jobs_online&quot;;
		span2.appendChild(textObj2);

		// remove existing child nodes from the parent node
		while(document.getElementById('jobcount').hasChildNodes()) {
			document.getElementById('jobcount').removeChild(document.getElementById('jobcount').firstChild);
		}

		// add newly create span tags to the parent node
		document.getElementById('jobcount').appendChild(span1);
		document.getElementById('jobcount').appendChild(span2);

	}

	if(typeof addLoadEvent != 'function') {
		function addLoadEvent(func) {
			var oldonload = window.onload;
			if (typeof window.onload != 'function') {
				window.onload = func;
			}
			else {
				window.onload = function() {
					if (oldonload) {
						oldonload();
					}
					func();
				}
			}
		}
	}

	addLoadEvent(redmatchJobCount);

&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://matt.thiessen.us/2009/02/deprecated-innerhtml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

