<?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>Austin Matzko&#039;s Blog &#187; JavaScript</title>
	<atom:link href="http://austinmatzko.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://austinmatzko.com</link>
	<description>A blog about philosophy, Christianity, web development and whatever else I feel like writing about.</description>
	<lastBuildDate>Wed, 16 Mar 2011 17:14:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2-RC4-18391</generator>
		<item>
		<title>I Am an Official Regex Day Winner</title>
		<link>http://austinmatzko.com/2008/06/06/happy-regex-day-to-me/</link>
		<comments>http://austinmatzko.com/2008/06/06/happy-regex-day-to-me/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 03:38:34 +0000</pubDate>
		<dc:creator>filosofo</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Regular Expressions]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[vi]]></category>

		<guid isPermaLink="false">http://www.ilfilosofo.com/?p=478</guid>
		<description><![CDATA[Ben Nadel declared June 1, 2008 the first National Regular Expression Day, and to celebrate he hosted a giveaway of regex-related prizes, including Jeffrey Friedl&#8217;s Mastering Regular Expressions. As you can see, I won the book and got it in the mail yesterday. I use regular expressions all the time&#8212;in PHP, JavaScript, Perl, sed, grep, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bennadel.com/index.cfm?dax=blog:1243.view">Ben Nadel declared June 1, 2008 the first National Regular Expression Day</a>, and to celebrate he hosted a giveaway of regex-related prizes, including Jeffrey Friedl&#8217;s <a href="http://www.amazon.com/Mastering-Regular-Expressions-Jeffrey-Friedl/dp/0596528124"><i>Mastering Regular Expressions</i></a>.  As you can see, I won the book and got it in the mail yesterday. I use <a href="http://en.wikipedia.org/wiki/Regular_expressions">regular expressions</a> all the time&#8212;in PHP, JavaScript, Perl, sed, grep, and vi&#8212;and they&#8217;re so essential to my work that I can&#8217;t wait to &#8220;master&#8221; them.  </p>
<p>I think I may have sunk to new lows of geekiness. </p>
<p><img src="http://www.ilfilosofo.com/wp-content/uploads/regex_book.jpg" alt="" title="regex_book" width="300" height="245" class="alignnone size-full wp-image-481" /></p>
]]></content:encoded>
			<wfw:commentRss>http://austinmatzko.com/2008/06/06/happy-regex-day-to-me/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Good Enough addEvent</title>
		<link>http://austinmatzko.com/2008/04/14/addevent-preserving-this/</link>
		<comments>http://austinmatzko.com/2008/04/14/addevent-preserving-this/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 03:48:00 +0000</pubDate>
		<dc:creator>filosofo</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[addEvent]]></category>
		<category><![CDATA[addEventListener]]></category>
		<category><![CDATA[attachEvent]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.ilfilosofo.com/?p=441</guid>
		<description><![CDATA[Several years ago, PPK of Quirksmode sponsored a contest to come up with a new version of the trusty JavaScript addEvent function. The original addEvent was created by Scott Andrew LePera in 2001 as a way to merge Internet Explorer&#8217;s attachEvent with the W3C&#8217;s addEventListener. Both addEventListener and attachEvent allow you to attach a JavaScript [...]]]></description>
			<content:encoded><![CDATA[<p>Several years ago, PPK of Quirksmode sponsored <a href="http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html">a contest to come up with a new version of the trusty JavaScript addEvent function</a>.  The original addEvent was <a href="http://www.scottandrew.com/weblog/articles/cbs-events">created by Scott Andrew LePera in 2001</a> as a way to merge Internet Explorer&#8217;s <code>attachEvent</code> with the W3C&#8217;s <code>addEventListener</code>.  Both <code>addEventListener</code> and <code>attachEvent</code> allow you to attach a JavaScript event to a DOM object, but they differ in important ways.  In particular, IE&#8217;s <code>attachEvent</code> doesn&#8217;t maintain the scope of the <code>this</code> keyword: <code>this</code> refers to the <code>window</code> object instead of the object on which you&#8217;re attaching the event, as in the case of <code>addEventListener</code>.  </p>
<p>PPK&#8217;s contest itself ended up falling flat, as even the winner, John Resig (who later created the <a href="http://jquery.com/">jQuery library</a>),  later <a href="http://my.opera.com/hallvors/blog/2007/03/28/a-problem-with-john-resigs-addevent#comment2703457">repudiated it himself</a>. That&#8217;s probably because PPK&#8217;s contest requirements were like asking for all three of good, fast, and cheap.</p>
<p>So seven years later, there&#8217;s no widely-adopted replacement to the original addEvent that:</p>
<ol>
<li>Is short</li>
<li>Maintains the <code>this</code> scope in IE</li>
<li>Has a corresponding removeEvent</li>
</ol>
<p>The various libraries do a good job of 2 and 3, but not 1, and since I often find myself needing 1 and 2 but not 3, I came up with my own good-enough version of addEvent:</p>
<div class="filosofo-highlight-light javascript" style="font-family: monospace;"><span style="color: #003366; font-weight: bold;">var</span> addEvent = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span> obj, type, fn <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>type, fn, <span style="color: #003366; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>obj.<span style="color: #006600;">attachEvent</span><span style="color: #66cc66;">&#41;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj.<span style="color: #006600;">attachEvent</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'on'</span> + type, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span> fn.<span style="color: #006600;">apply</span><span style="color: #66cc66;">&#40;</span>obj, <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #66cc66;">&#40;</span>window.<span style="color: #006600;">event</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><br />
&nbsp;</div>
<p>It&#8217;s short, which is just what I need when I&#8217;m trying to keep the JavaScript size low.  (Whenever size isn&#8217;t so much of an issue, such as on the administrative side of a website, I&#8217;m more likely to use a library which will have a much more robust way of assigning events to objects.)  And my addEvent also makes <code>this</code> refer to object in question, even for IE.  </p>
]]></content:encoded>
			<wfw:commentRss>http://austinmatzko.com/2008/04/14/addevent-preserving-this/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>JavaScript Email Hiding</title>
		<link>http://austinmatzko.com/2005/06/28/javascript-email-hiding/</link>
		<comments>http://austinmatzko.com/2005/06/28/javascript-email-hiding/#comments</comments>
		<pubDate>Tue, 28 Jun 2005 18:08:55 +0000</pubDate>
		<dc:creator>filosofo</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.ilfilosofo.com/blog/2005/06/28/javascript-email-hiding/</guid>
		<description><![CDATA[If you plainly show an email address on a website, it&#8217;s likely to be harvested by a spam spider. To get around that problem, I&#8217;ve been using the following JavaScript in the middle of a page: &#60;script type=&#34;text/javascript&#34;&#62; &#60;!-- This script hides the email address from spiders --&#62; &#160; &#160; &#160; &#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[If you plainly show an email address on a website, it&rsquo;s likely to be harvested by a spam spider.  To get around that problem, I&rsquo;ve <em>been</em> using the following JavaScript in the middle of a page:

<div class="filosofo-highlight-light javascript" style="font-family: monospace;"><br />
<br />
<span style="color: #66cc66;">&lt;</span>script type=<span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #66cc66;">&gt;</span> <span style="color: #66cc66;">&lt;!</span>-- <span style="color: #000066; font-weight: bold;">This</span> script hides the email address from spiders --<span style="color: #66cc66;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&lt;!</span>-- Begin hide from old browsers<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; username = <span style="color: #3366CC;">&quot;webmaster&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; site = <span style="color: #3366CC;">&quot;ibcboston.org&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&lt;</span>a href=<span style="color: #3366CC;">&quot;mailto:&amp;#39; + username + &amp;#39;@&amp;#39; + site + &amp;#39;&quot;</span><span style="color: #66cc66;">&gt;&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #66cc66;">&#40;</span>username + <span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">@&amp;</span>#<span style="color: #CC0000;">39</span>; + site + <span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&lt;/</span>a<span style="color: #66cc66;">&gt;&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// End --&gt;</span><br />
<span style="color: #66cc66;">&lt;</span><span style="color: #0066FF;">/script&gt;&lt;noscript&gt;&lt;div&gt;webmaster _at_ ilfilosofo _dot_ org&lt;/div&gt;&lt;/</span>noscript<span style="color: #66cc66;">&gt;</span><br />
<br />
&nbsp;</div>


JavaScript-enabled browsers re-assemble the email address for their users, and humans without JavaScript can figure out the address shown between the &lt;noscript&gt; tags.  

This approach is clunky: you have to repeat little JavaScripts everywhere you have an email address, XHTML validators aren&rsquo;t happy to see it, and it doesn&rsquo;t abstract structure and behavior.

So I wrote a short JavaScript function that looks for &lt;span&gt;s of class &ldquo;hiddenemail.&rdquo;  For each span that it finds with class &ldquo;hiddenemail,&rdquo; it puts together into a mailto: link the &lt;span&gt;s within it that have classes of &ldquo;name,&rdquo; &ldquo;domain,&rdquo; and &ldquo;tld&rdquo; (tld = &ldquo;top level domain&rdquo;).  Everything else, such as the &ldquo;_at_&rdquo; or &ldquo;_dot_&rdquo; it just ignores: you can put anything there to confuse spiders (but inform those without JavaScript enabled).  Mark up your email address like so:
<pre>
&lt;span class=&quot;hiddenemail&quot;&gt;
&lt;span class=&quot;name&quot;&gt;webmaster&lt;/span&gt; _at_ 
&lt;span class=&quot;domain&quot;&gt;ilfilosofo&lt;/span&gt; _dot_ &lt;span class=&quot;tld&quot;&gt;com&lt;/span&gt;
&lt;/span&gt;
</pre>
And run the function below when the page loads (e.g. window.onload = revealEmails();)

<div class="filosofo-highlight-light javascript" style="font-family: monospace;"><br />
<br />
<span style="color: #009900; font-style: italic;">//************************************************************************</span><br />
<span style="color: #003366; font-weight: bold;">function</span> revealEmails<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #009900; font-style: italic;">//changes hidden email names within span tags to clickable addresses</span><br />
<span style="color: #009900; font-style: italic;">//looks for span class of &amp;#39;hiddenemail&amp;#39;</span><br />
<span style="color: #009900; font-style: italic;">// &nbsp; &nbsp;inside that class it looks for span classes of &amp;#39;name&amp;#39;,&amp;#39;domain&amp;#39;, and &amp;#39;tld&amp;#39;</span><br />
<span style="color: #009900; font-style: italic;">// from http://www.ilfilosofo.com/blog/2005/06/28/javascript-email-hiding/</span><br />
<span style="color: #009900; font-style: italic;">//************************************************************************</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> x = document.<span style="color: #006600;">getElementsByTagName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;span<span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i=<span style="color: #CC0000;">0</span>;i<span style="color: #66cc66;">&lt;</span>x.<span style="color: #006600;">length</span>;i++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> address;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>x<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">className</span> == <span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;hiddenemail<span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> y = x<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">getElementsByTagName</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;span<span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j=<span style="color: #CC0000;">0</span>;j<span style="color: #66cc66;">&lt;</span>y.<span style="color: #006600;">length</span>;j++<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>y<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">className</span> == <span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;name<span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>y<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">innerHTML</span> <span style="color: #66cc66;">!</span>== <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; address = y<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">innerHTML</span> + <span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">@&amp;</span>#<span style="color: #CC0000;">39</span>;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>y<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">className</span> == <span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;domain<span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>y<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">innerHTML</span> <span style="color: #66cc66;">!</span>== <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; address = address + y<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">innerHTML</span> + <span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;.<span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>y<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">className</span> == <span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;tld<span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>y<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">innerHTML</span> <span style="color: #66cc66;">!</span>== <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; address = address + y<span style="color: #66cc66;">&#91;</span>j<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">innerHTML</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>x<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">innerHTML</span> <span style="color: #66cc66;">!</span>== <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;&amp;</span> <span style="color: #66cc66;">&#40;</span>address <span style="color: #66cc66;">!</span>== <span style="color: #003366; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">innerHTML</span> = <span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&lt;</span>a href=<span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;mailto:<span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>; + address + <span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&gt;&amp;</span>#<span style="color: #CC0000;">39</span>; + address + <span style="color: #66cc66;">&amp;</span>#<span style="color: #CC0000;">39</span>;<span style="color: #66cc66;">&lt;/</span>a<span style="color: #66cc66;">&gt;&amp;</span>#<span style="color: #CC0000;">39</span>;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><br />
<span style="color: #66cc66;">&#125;</span><br />
<br />
&nbsp;</div>


By the way, some such as JavaScript guru Peter-Paul Koch think that <a href="http://alistapart.com/articles/scripttriggers/" class="offsite">classes are for CSS, not JavaScript</a>.  What I&rsquo;m doing violates the separation of style and behavior, he would say.  But I don&rsquo;t see that.  If you can use &ldquo;id&rdquo; for both CSS and JavaScript, why not &ldquo;class&rdquo;?  ]]></content:encoded>
			<wfw:commentRss>http://austinmatzko.com/2005/06/28/javascript-email-hiding/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
