<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Need Help With Table Row Events</title>
	<atom:link href="http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/feed/" rel="self" type="application/rss+xml" />
	<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/</link>
	<description>Things that Eric A. Meyer, CSS expert, writes about on his personal Web site; it&#039;s largely Web standards and Web technology, but also various bits of culture, politics, personal observations, and other miscellaneous stuff</description>
	<lastBuildDate>Tue, 18 Jun 2013 15:30:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Borgar.net &#187; Node members or Node attributes</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-436813</link>
		<dc:creator>Borgar.net &#187; Node members or Node attributes</dc:creator>
		<pubDate>Sat, 17 Jan 2009 01:18:39 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-436813</guid>
		<description><![CDATA[[...] given it a bit of thought I think that this problem stems from a slight confusion as to how DOM nodes&#8217; attributes [...]]]></description>
		<content:encoded><![CDATA[<p>[...] given it a bit of thought I think that this problem stems from a slight confusion as to how DOM nodes&#8217; attributes [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rahul</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-396282</link>
		<dc:creator>Rahul</dc:creator>
		<pubDate>Tue, 29 Jul 2008 14:01:40 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-396282</guid>
		<description><![CDATA[Hello Eric,

Thanks for posting this question. I was facing the same problem. Your post and the comment did help me out. Thanks. 

But going further, I am facing same problem as mentioned in comment #8. i.e &quot;The only problem is that the id and event have scoping issues and will be bound to the last values they encountered as we set up all the onclicks...&quot;

You certainly must have faced same problem. It would be great if you post how you work around that issue as well. 

Thanks in advance..

Rahul]]></description>
		<content:encoded><![CDATA[<p>Hello Eric,</p>
<p>Thanks for posting this question. I was facing the same problem. Your post and the comment did help me out. Thanks. </p>
<p>But going further, I am facing same problem as mentioned in comment #8. i.e &#8220;The only problem is that the id and event have scoping issues and will be bound to the last values they encountered as we set up all the onclicks&#8230;&#8221;</p>
<p>You certainly must have faced same problem. It would be great if you post how you work around that issue as well. </p>
<p>Thanks in advance..</p>
<p>Rahul</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Gregory</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-382641</link>
		<dc:creator>Andrew Gregory</dc:creator>
		<pubDate>Thu, 05 Jun 2008 03:55:47 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-382641</guid>
		<description><![CDATA[Eric, if you can, please, please, please change the third parameter of addEventListener in your comment #37 to false! Having true there will set up what&#039;s called a &quot;capturing&quot; event handler (explained on PPKs page) which is NOT what you want, while the IE compatible attachEvent you&#039;ve got on the next line implements non-capturing.

Unintended event capturing breaks pages for the minor browsers that support it (currently Opera and Safari, but soon Firefox 3).]]></description>
		<content:encoded><![CDATA[<p>Eric, if you can, please, please, please change the third parameter of addEventListener in your comment #37 to false! Having true there will set up what&#8217;s called a &#8220;capturing&#8221; event handler (explained on PPKs page) which is NOT what you want, while the IE compatible attachEvent you&#8217;ve got on the next line implements non-capturing.</p>
<p>Unintended event capturing breaks pages for the minor browsers that support it (currently Opera and Safari, but soon Firefox 3).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Meyer</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-381427</link>
		<dc:creator>Eric Meyer</dc:creator>
		<pubDate>Sun, 01 Jun 2008 04:00:44 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-381427</guid>
		<description><![CDATA[I dunno, &lt;a href=&quot;http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-381422&quot; rel=&quot;nofollow&quot;&gt;Jason&lt;/a&gt;, but I&#039;m just now most of the way done with a detailed rant on that very topic.  I expect to post it Sunday or Monday (probably the latter).]]></description>
		<content:encoded><![CDATA[<p>I dunno, <a href="http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-381422" rel="nofollow">Jason</a>, but I&#8217;m just now most of the way done with a detailed rant on that very topic.  I expect to post it Sunday or Monday (probably the latter).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Penney</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-381422</link>
		<dc:creator>Jason Penney</dc:creator>
		<pubDate>Sun, 01 Jun 2008 03:29:31 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-381422</guid>
		<description><![CDATA[I totally agree on the XHTML2/href thing. I remeber thinking how much that would simplify things. Was there a reason that was dropped or was it just overlooked?]]></description>
		<content:encoded><![CDATA[<p>I totally agree on the XHTML2/href thing. I remeber thinking how much that would simplify things. Was there a reason that was dropped or was it just overlooked?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Meyer</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-381409</link>
		<dc:creator>Eric Meyer</dc:creator>
		<pubDate>Sun, 01 Jun 2008 00:53:34 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-381409</guid>
		<description><![CDATA[&lt;a href=&quot;http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-381356&quot; rel=&quot;nofollow&quot;&gt;Remy&lt;/a&gt;: if by the &quot;delegation code&quot; you mean the actual function &lt;code&gt;gotoCall&lt;/code&gt;, then that&#039;s what I meant.  Something like:

&lt;pre&gt;&lt;code&gt;function callGoto(e) {
  if (!e) e = event;
  var src = e.target &#124;&#124; e.srcElement;
  while (src.nodeName != &quot;TABLE&quot;) {
    if (src.nodeName == &quot;TR&quot;) {
      if (src.class == &quot;one&quot; &#124;&#124; src.class == &quot;two&quot; &#124;&#124; src.id != &quot;blah&quot;) {
        var id = src.id;
        return goto(id, conferenceID);
      }
    }
    src = src.parentNode;
  }
}
&lt;/code&gt;&lt;/pre&gt;

...though there&#039;s probably a less clumsy way to roll all the innermost &quot;if&quot;s together, and that innermost &quot;if&quot; is probably pseudocode as it stands (I don&#039;t think &lt;code&gt;el.class&lt;/code&gt; is really valid, is it?).  But that&#039;s basically what I was meaning.  Good to know that brute-forcing a click event onto every row of tables this size isn&#039;t going to be a big performance loss.

Of course, absolutely none of this would be necessary if HTML5 restored the &lt;code&gt;href&lt;/code&gt; attribute to all elements, which was one of the few things I thought XHTML2 got absolutely totally 110% correct.  Then all I&#039;d have to do is slap the necessary &lt;code&gt;href&lt;/code&gt; on each &lt;code&gt;tr&lt;/code&gt; element and be finished with this really stupidly simple requirement in twenty seconds instead of juggling a dozen script eggs in an attempt to make stuff clickable.]]></description>
		<content:encoded><![CDATA[<p><a href="http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-381356" rel="nofollow">Remy</a>: if by the &#8220;delegation code&#8221; you mean the actual function <code>gotoCall</code>, then that&#8217;s what I meant.  Something like:</p>
<pre><code>function callGoto(e) {
  if (!e) e = event;
  var src = e.target || e.srcElement;
  while (src.nodeName != "TABLE") {
    if (src.nodeName == "TR") {
      if (src.class == "one" || src.class == "two" || src.id != "blah") {
        var id = src.id;
        return goto(id, conferenceID);
      }
    }
    src = src.parentNode;
  }
}
</code></pre>
<p>&#8230;though there&#8217;s probably a less clumsy way to roll all the innermost &#8220;if&#8221;s together, and that innermost &#8220;if&#8221; is probably pseudocode as it stands (I don&#8217;t think <code>el.class</code> is really valid, is it?).  But that&#8217;s basically what I was meaning.  Good to know that brute-forcing a click event onto every row of tables this size isn&#8217;t going to be a big performance loss.</p>
<p>Of course, absolutely none of this would be necessary if HTML5 restored the <code>href</code> attribute to all elements, which was one of the few things I thought XHTML2 got absolutely totally 110% correct.  Then all I&#8217;d have to do is slap the necessary <code>href</code> on each <code>tr</code> element and be finished with this really stupidly simple requirement in twenty seconds instead of juggling a dozen script eggs in an attempt to make stuff clickable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Remy Sharp</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-381356</link>
		<dc:creator>Remy Sharp</dc:creator>
		<pubDate>Sat, 31 May 2008 18:15:49 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-381356</guid>
		<description><![CDATA[By way of pushing best practises a little further, add this code to your JS snippets:

&lt;code&gt;addEvent = (function () {
&#160;&#160;return document.body.addEventListener ? function (e, ev, fn) {
&#160;&#160;&#160;&#160;e.addEventListener(ev, fn, false);
&#160;&#160;} : function () {
&#160;&#160;&#160;&#160;e.attachEvent(&quot;on&quot; + ev, fn);
&#160;&#160;};
})();

// usage:
addEvent(element, &#039;click&#039;, function () {
&#160;&#160;// do stuff
});&lt;/code&gt;

It&#039;s a pretty common design pattern - it looks for the method to attach the events and creates the appropriate function.

Re: delegation to solve your problem.  The way you&#039;ve suggested, i.e. checking for a class to ignore particular rows would be the best way to do it  (until we get data attributes in HTML5...) - but it wouldn&#039;t be in the gotoCall function - it would be in the delegation code.  

However, for the size of the table - there&#039;s definitely isn&#039;t going to be a measurable performance benefit.  Go with what makes more sense to you now :-)]]></description>
		<content:encoded><![CDATA[<p>By way of pushing best practises a little further, add this code to your JS snippets:</p>
<p><code>addEvent = (function () {<br />
&nbsp;&nbsp;return document.body.addEventListener ? function (e, ev, fn) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;e.addEventListener(ev, fn, false);<br />
&nbsp;&nbsp;} : function () {<br />
&nbsp;&nbsp;&nbsp;&nbsp;e.attachEvent("on" + ev, fn);<br />
&nbsp;&nbsp;};<br />
})();</p>
<p>// usage:<br />
addEvent(element, 'click', function () {<br />
&nbsp;&nbsp;// do stuff<br />
});</code></p>
<p>It&#8217;s a pretty common design pattern &#8211; it looks for the method to attach the events and creates the appropriate function.</p>
<p>Re: delegation to solve your problem.  The way you&#8217;ve suggested, i.e. checking for a class to ignore particular rows would be the best way to do it  (until we get data attributes in HTML5&#8230;) &#8211; but it wouldn&#8217;t be in the gotoCall function &#8211; it would be in the delegation code.  </p>
<p>However, for the size of the table &#8211; there&#8217;s definitely isn&#8217;t going to be a measurable performance benefit.  Go with what makes more sense to you now :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Larsen</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-381355</link>
		<dc:creator>John Larsen</dc:creator>
		<pubDate>Sat, 31 May 2008 17:56:33 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-381355</guid>
		<description><![CDATA[How about iterating over the rows and setting a property to flag whether the row should be ignored? Then use delegation with an initial test of the flag. If the flag is false just return.]]></description>
		<content:encoded><![CDATA[<p>How about iterating over the rows and setting a property to flag whether the row should be ignored? Then use delegation with an initial test of the flag. If the flag is false just return.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Meyer</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-381080</link>
		<dc:creator>Eric Meyer</dc:creator>
		<pubDate>Sat, 31 May 2008 01:31:04 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-381080</guid>
		<description><![CDATA[Um, you just posted more or less what ProggerPete did, except not in actual JS, and nothing about the parts that I said elude me.  I do appreciate the effort, but unfortunately it seems to have gone to repeating an existing answer and not answering the existing questions.

&lt;strong&gt;Update:&lt;/strong&gt; &lt;a href=&quot;http://www.quirksmode.org/js/events_advanced.html&quot; rel=&quot;nofollow&quot;&gt;thanks to PPK&lt;/a&gt; (who else?), I worked out how to add the table handler in a cross-browser fashion:

&lt;pre&gt;
if (t.addEventListener) {t.addEventListener(&#039;click&#039;,callGoto,true);}
if (t.attachEvent) {t.attachEvent(&#039;onclick&#039;,callGoto);}
&lt;/pre&gt;

Not the most robust, perhaps, but it works well enough.  I also figured out how to handle the event determination in a way that made sense to me, which was to set up a global variable and give it the needed value in my onLoad routine.

It was at that point I realized that event delegation probably won&#039;t work well in my case, because not every row of the table should be clickable---in my current working file, about three out of ~35 rows are non-clickable.  So it actually makes more sense for me to collect all the rows I want to make clickable and assign them their own event handlers, I think.  The only way around it I can see is to do delegation and then have more code in &#039;gotoCall&#039; that checks against a class or a list of IDs that should be ignored, and that seems kind of ugly.  This table isn&#039;t ever going to have more than 60 or 70 rows, and that&#039;s a very padded estimate.

But I did learn a lot more about events and event handling, for which I thank you all!]]></description>
		<content:encoded><![CDATA[<p>Um, you just posted more or less what ProggerPete did, except not in actual JS, and nothing about the parts that I said elude me.  I do appreciate the effort, but unfortunately it seems to have gone to repeating an existing answer and not answering the existing questions.</p>
<p><strong>Update:</strong> <a href="http://www.quirksmode.org/js/events_advanced.html" rel="nofollow">thanks to PPK</a> (who else?), I worked out how to add the table handler in a cross-browser fashion:</p>
<pre>
if (t.addEventListener) {t.addEventListener('click',callGoto,true);}
if (t.attachEvent) {t.attachEvent('onclick',callGoto);}
</pre>
<p>Not the most robust, perhaps, but it works well enough.  I also figured out how to handle the event determination in a way that made sense to me, which was to set up a global variable and give it the needed value in my onLoad routine.</p>
<p>It was at that point I realized that event delegation probably won&#8217;t work well in my case, because not every row of the table should be clickable&#8212;in my current working file, about three out of ~35 rows are non-clickable.  So it actually makes more sense for me to collect all the rows I want to make clickable and assign them their own event handlers, I think.  The only way around it I can see is to do delegation and then have more code in &#8216;gotoCall&#8217; that checks against a class or a list of IDs that should be ignored, and that seems kind of ugly.  This table isn&#8217;t ever going to have more than 60 or 70 rows, and that&#8217;s a very padded estimate.</p>
<p>But I did learn a lot more about events and event handling, for which I thank you all!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tuan</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-381074</link>
		<dc:creator>Tuan</dc:creator>
		<pubDate>Sat, 31 May 2008 01:16:59 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-381074</guid>
		<description><![CDATA[here&#039;s some pseudo code for you. Only thing you have to worry about is getting the event target from the event object. The rest is pretty simple. If you&#039;re using a library like Prototype, you could do all this with just a few lines.

var handleClick = function(event) {
  // get the element inside the table that fired the event
  var el = event.target; // add logic here for cross browser

  // check if the element is a TR, if not then keep going up the
  // DOM tree til you reach one and stop when you&#039;re at the table
  while(el.tagName != &#039;TR&#039;) {
    el = el.parentNode;
    if(el.tagName == &#039;TABLE&#039;) { // reached the table itself, passed any TR element, bail out
      return;
    }
  }

  // if you&#039;re here, you got the TR and assuming it has an id, just call your function
  goTo(el.id, event);
}

....]]></description>
		<content:encoded><![CDATA[<p>here&#8217;s some pseudo code for you. Only thing you have to worry about is getting the event target from the event object. The rest is pretty simple. If you&#8217;re using a library like Prototype, you could do all this with just a few lines.</p>
<p>var handleClick = function(event) {<br />
  // get the element inside the table that fired the event<br />
  var el = event.target; // add logic here for cross browser</p>
<p>  // check if the element is a TR, if not then keep going up the<br />
  // DOM tree til you reach one and stop when you&#8217;re at the table<br />
  while(el.tagName != &#8216;TR&#8217;) {<br />
    el = el.parentNode;<br />
    if(el.tagName == &#8216;TABLE&#8217;) { // reached the table itself, passed any TR element, bail out<br />
      return;<br />
    }<br />
  }</p>
<p>  // if you&#8217;re here, you got the TR and assuming it has an id, just call your function<br />
  goTo(el.id, event);<br />
}</p>
<p>&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Meyer</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380981</link>
		<dc:creator>Eric Meyer</dc:creator>
		<pubDate>Fri, 30 May 2008 20:17:39 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-380981</guid>
		<description><![CDATA[Unfortunately, while I get the principles behind event delegation, I don&#039;t know how to add a click handler to the table such that it will take advantage of &lt;a href=&quot;http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380775&quot; rel=&quot;nofollow&quot;&gt;the routine ProggerPete posted&lt;/a&gt;.  The actual routine I understand.  Just not how to properly invoke it.

Oh wait, no, I don&#039;t understand one part of it, which is the &#039;idEventMap&#039; part.  Sorry.

Oh, or how to do it so it works in IE7, which it doesn&#039;t when I try it in such a way that it works in Gecko.  Sorry again.]]></description>
		<content:encoded><![CDATA[<p>Unfortunately, while I get the principles behind event delegation, I don&#8217;t know how to add a click handler to the table such that it will take advantage of <a href="http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380775" rel="nofollow">the routine ProggerPete posted</a>.  The actual routine I understand.  Just not how to properly invoke it.</p>
<p>Oh wait, no, I don&#8217;t understand one part of it, which is the &#8216;idEventMap&#8217; part.  Sorry.</p>
<p>Oh, or how to do it so it works in IE7, which it doesn&#8217;t when I try it in such a way that it works in Gecko.  Sorry again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tuan</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380967</link>
		<dc:creator>Tuan</dc:creator>
		<pubDate>Fri, 30 May 2008 19:32:56 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-380967</guid>
		<description><![CDATA[oh man, it took 30 posts for someone to suggest event delegation. It should have been the first!

facepalm]]></description>
		<content:encoded><![CDATA[<p>oh man, it took 30 posts for someone to suggest event delegation. It should have been the first!</p>
<p>facepalm</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Meyer</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380921</link>
		<dc:creator>Eric Meyer</dc:creator>
		<pubDate>Fri, 30 May 2008 16:48:51 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-380921</guid>
		<description><![CDATA[Thanks for that, &lt;a href=&quot;http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380863&quot; rel=&quot;nofollow&quot;&gt;Eric&lt;/a&gt;-- I had no idea you could set up multiple variables in the first term of a &#039;for&#039; loop&#039;s parameters!  Makes sense that it would be a performance win, and I always like to learn best practices.  I&#039;m adding that as soon as I post this comment.

&lt;a href=&quot;http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380562&quot; rel=&quot;nofollow&quot;&gt;Jeremy&lt;/a&gt;, I&#039;ve no doubt I&#039;m coding old-school, and I did try some of the functionality-testing code you suggest.  It wasn&#039;t helping (due to my botching the whole &#039;onclick&#039; thing) so I took it out.  Now that I&#039;ve got things actually working thanks to all you awesome folks, I&#039;ll start adding that kind of feature-detected code back in.  I&#039;ll also look into delegation and bubbling as suggested by &lt;a href=&quot;http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380775&quot; rel=&quot;nofollow&quot;&gt;ProggerPete&lt;/a&gt; and &lt;a href=&quot;http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380618&quot; rel=&quot;nofollow&quot;&gt;Justin&lt;/a&gt;.]]></description>
		<content:encoded><![CDATA[<p>Thanks for that, <a href="http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380863" rel="nofollow">Eric</a>&#8211; I had no idea you could set up multiple variables in the first term of a &#8216;for&#8217; loop&#8217;s parameters!  Makes sense that it would be a performance win, and I always like to learn best practices.  I&#8217;m adding that as soon as I post this comment.</p>
<p><a href="http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380562" rel="nofollow">Jeremy</a>, I&#8217;ve no doubt I&#8217;m coding old-school, and I did try some of the functionality-testing code you suggest.  It wasn&#8217;t helping (due to my botching the whole &#8216;onclick&#8217; thing) so I took it out.  Now that I&#8217;ve got things actually working thanks to all you awesome folks, I&#8217;ll start adding that kind of feature-detected code back in.  I&#8217;ll also look into delegation and bubbling as suggested by <a href="http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380775" rel="nofollow">ProggerPete</a> and <a href="http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380618" rel="nofollow">Justin</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric DeLabar</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380863</link>
		<dc:creator>Eric DeLabar</dc:creator>
		<pubDate>Fri, 30 May 2008 12:50:57 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-380863</guid>
		<description><![CDATA[Glad you found your solution, but here&#039;s a little constructive criticism on performance.  In general, with JavaScript, when using a for loop it&#039;s better to set a variable for the length than to call the length property on every iteration through the loop.  

e.g.&lt;code&gt;
...
var size = mapStates.length;
for (x = 0; x &lt; size; x++) {
...
&lt;/code&gt;

or for brevity&#039;s sake:
&lt;code&gt;
...
for (x = 0, size = mapStates.length; x &lt; size; x++) {
...
&lt;/code&gt;

In JavaScript the value of length could change for each iteration, so it&#039;s evaluated each time through instead of just being checked like a variable would be.  With all of the JavaScript being written for today&#039;s &quot;Web 2.0&quot; sites every millisecond counts, and since this is a learning exercise it&#039;s better to learn the best practice!]]></description>
		<content:encoded><![CDATA[<p>Glad you found your solution, but here&#8217;s a little constructive criticism on performance.  In general, with JavaScript, when using a for loop it&#8217;s better to set a variable for the length than to call the length property on every iteration through the loop.  </p>
<p>e.g.<code><br />
...<br />
var size = mapStates.length;<br />
for (x = 0; x &lt; size; x++) {<br />
...<br />
</code></p>
<p>or for brevity&#8217;s sake:<br />
<code><br />
...<br />
for (x = 0, size = mapStates.length; x &lt; size; x++) {<br />
...<br />
</code></p>
<p>In JavaScript the value of length could change for each iteration, so it&#8217;s evaluated each time through instead of just being checked like a variable would be.  With all of the JavaScript being written for today&#8217;s &#8220;Web 2.0&#8243; sites every millisecond counts, and since this is a learning exercise it&#8217;s better to learn the best practice!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Bex</title>
		<link>http://meyerweb.com/eric/thoughts/2008/05/29/need-help-with-table-row-events/#comment-380776</link>
		<dc:creator>Peter Bex</dc:creator>
		<pubDate>Fri, 30 May 2008 08:36:17 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/?p=906#comment-380776</guid>
		<description><![CDATA[In common parlance, &quot;method&quot; just means a function on an object, but the difference between function and method is not made in Javascript. You can assign any function to any property on an object and it &quot;becomes&quot; a method.

One real difference you can notice in Javascript is that when the function is called as a method (ie, like &lt;code&gt;obj.propertyname(arg1, arg2);&lt;/code&gt;), there is a special variable called &lt;code&gt;this&lt;/code&gt; that has the value of the object that the method was called on (&lt;code&gt;obj&lt;/code&gt; in the example). If a function is called directly (not &quot;on an object&quot;), &lt;code&gt;this&lt;/code&gt; has the value of the &quot;global object&quot;, which is &lt;code&gt;window&lt;/code&gt; in Javascript.]]></description>
		<content:encoded><![CDATA[<p>In common parlance, &#8220;method&#8221; just means a function on an object, but the difference between function and method is not made in Javascript. You can assign any function to any property on an object and it &#8220;becomes&#8221; a method.</p>
<p>One real difference you can notice in Javascript is that when the function is called as a method (ie, like <code>obj.propertyname(arg1, arg2);</code>), there is a special variable called <code>this</code> that has the value of the object that the method was called on (<code>obj</code> in the example). If a function is called directly (not &#8220;on an object&#8221;), <code>this</code> has the value of the &#8220;global object&#8221;, which is <code>window</code> in Javascript.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->