<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1038878" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1038878</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/how-do-i-use-addevent-script#comment-1221486</link>
    <description> &lt;p&gt;I already have a getElementsByClassName function - what I need to do is bundle it together with the event handlers.&lt;/p&gt;
&lt;p&gt;(no time to work on this right now - might revisit it later)&lt;/p&gt;
 </description>
     <pubDate>Wed, 11 Jul 2007 12:54:33 +0000</pubDate>
 <dc:creator>Megan</dc:creator>
 <guid isPermaLink="false">comment 1221486 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/how-do-i-use-addevent-script#comment-1221470</link>
    <description> &lt;p&gt;Ah! Okay, now I see what you are trying to do.&lt;/p&gt;
&lt;p&gt;I think you are looking for a &quot;getElementsByClassName&quot; function. That way, you can create an array of your &#039;class=&quot;icon&quot;&#039; elements and loop through it to attach your &quot;mouseover&quot; and &quot;mouseout&quot; events. You may want to add &quot;focus&quot; and &quot;blur&quot; events for keyboard users as well.&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;function walkTheDOM(node, func) {&lt;br /&gt;&amp;nbsp; func(node);&lt;br /&gt;&amp;nbsp; node = node.firstChild;&lt;br /&gt;&amp;nbsp; while(node) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; walkTheDOM(node, func);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; node = node.nextSibling;&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function getElementsByClassName(className) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var results = [];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; walkTheDOM(document.body, function(node) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var a, c = node.className, i;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (c) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a = c.split(&amp;#039; &amp;#039;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (i=0; i&amp;lt;a.length; i++) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (a[i] === className) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; results.push(node);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return results;&lt;br /&gt;}&lt;/code&gt;&lt;/div&gt;&#039;&lt;br /&gt;
More stuff on those lines here:&lt;br /&gt;
&lt;a href=&quot;http://getelementsby.com/&quot; class=&quot;bb-url&quot;&gt;http://getelementsby.com/&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Tue, 10 Jul 2007 21:09:24 +0000</pubDate>
 <dc:creator>webwiz</dc:creator>
 <guid isPermaLink="false">comment 1221470 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/how-do-i-use-addevent-script#comment-1221463</link>
    <description> &lt;p&gt;The hover &lt;em&gt;is&lt;/em&gt; on the a element. It works fine in IE 6. And I knew I was correct that you can&#039;t put block tags in a span. That&#039;s pretty basic &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
&lt;p&gt;What I&#039;m trying to do is find a way to do the same thing but include block level elements. I was almost there with my previous example but would have to position the tooltip differently. The work in progress is now here:&lt;/p&gt;
&lt;p&gt;[url]http://www.housing.uwaterloo.ca/tempages/moving-late(tooltips).html[/url]&lt;/p&gt;
&lt;p&gt;The first problem is that the tooltip is currently positioned relative to it&#039;s contiaining div, which isn&#039;t working right now for the second example where the icon is located in the middle of the paragraph.&lt;/p&gt;
&lt;p&gt;The second problem is that there is a lot of repetition of code for each time you call the tooltip. It would be nice if you didn&#039;t have to rewrite the event handlers each time you wanted a tooltip. It would be nice if I could consolidate that part and the toggle functions they refer to into one function that would be set for all the tooltips. That would make it much easier to re-use.&lt;/p&gt;
 </description>
     <pubDate>Tue, 10 Jul 2007 13:20:46 +0000</pubDate>
 <dc:creator>Megan</dc:creator>
 <guid isPermaLink="false">comment 1221463 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/how-do-i-use-addevent-script#comment-1221425</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;Quote: I am still interested in getting this to work for block level elements. You can&#039;t do that with the solution I linked because the tooltip text is in a span.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I&#039;m not sure what you mean by this, Megan. If it&#039;s a tooltip you are after, then, yes, that CSS solution is easier to write and maintain than a script. To get it to work in IE6 and older, the :hover only works on an &quot;a&quot; element. Because an &quot;a&quot; element can only contain inline elements, you are correct in noting you are restricted to a &quot;span&quot; or similar inline element. For modern browsers and IE7, you can add :hover to whatever you like.&lt;/p&gt;
&lt;p&gt;Dean Edwards has written something he calls &quot;IE7&quot;[1] -- a JavaScript that makes IE6 more CSS capable. That may be overkill for your requirements, though.&lt;/p&gt;
&lt;p&gt;Can you please explain exactly what you hope to achieve? At the moment, I am only guessing.&lt;/p&gt;
&lt;p&gt;[1] &lt;a href=&quot;http://dean.edwards.name/IE7/intro/&quot; class=&quot;bb-url&quot;&gt;http://dean.edwards.name/IE7/intro/&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Mon, 09 Jul 2007 20:43:04 +0000</pubDate>
 <dc:creator>webwiz</dc:creator>
 <guid isPermaLink="false">comment 1221425 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/how-do-i-use-addevent-script#comment-1221423</link>
    <description> &lt;p&gt;Thanks for the reference &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt; I found some other problems with that script (namely that you run into problems with the positioning when the icon is placed within a paragraph or other element). I decided to forget about trying to get it to work for block level elements and just used this simple CSS solution instead:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://psacake.com/web/jl.asp&quot; class=&quot;bb-url&quot;&gt;http://psacake.com/web/jl.asp&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Simple and easy. I&#039;m not thrilled with the concept of putting the tooltip inside the link, or in a span (should be a paragraph), but I&#039;ve spent way too much time trying to figure this out already...&lt;/p&gt;
&lt;p&gt;I am still interested in getting this to work for block level elements. You can&#039;t do that with the solution I linked because the tooltip text is in a span.&lt;/p&gt;
 </description>
     <pubDate>Mon, 09 Jul 2007 20:28:18 +0000</pubDate>
 <dc:creator>Megan</dc:creator>
 <guid isPermaLink="false">comment 1221423 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/how-do-i-use-addevent-script#comment-1221421</link>
    <description> &lt;p&gt;Hey, Megan,&lt;br /&gt;
If you are at the U. of Waterloo, Canada, don&#039;t waste time with amateurs like me. Locate Mike Purvis, a brilliant student and far more worthy of the moniker &quot;web wiz&quot; than I --&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://uwmike.com/&quot; class=&quot;bb-url&quot;&gt;http://uwmike.com/&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Mon, 09 Jul 2007 20:20:39 +0000</pubDate>
 <dc:creator>webwiz</dc:creator>
 <guid isPermaLink="false">comment 1221421 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/how-do-i-use-addevent-script#comment-1221406</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;webwiz;221201 wrote:&lt;/strong&gt; You are almost there with your first version, Megan.&lt;/p&gt;
&lt;p&gt;Instead of passing &quot;alert(&#039;somethinghere&#039;)&quot; as your third argument, pass the name of an actual function. Viz:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;function myFun() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&amp;#039;somethinghere&amp;#039;);&lt;br /&gt;}&lt;br /&gt;window.onload=function() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; addEvent(document.getElementById(&amp;#039;datehelpicon&amp;#039;), &amp;#039;click&amp;#039;, myFun);&lt;br /&gt;};&lt;/code&gt;&lt;/div&gt;&#039;
&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I have that working - my next question is whether I can streamline myFun so it would work for multiple elements. So could I do something like this?&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;function myFun(thingamie) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(thingamie);&lt;br /&gt;}&lt;br /&gt;window.onload=function() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; addEvent(document.getElementById(&amp;#039;datehelpicon&amp;#039;), &amp;#039;click&amp;#039;, myFun(&amp;#039;valuehere&amp;#039;));&lt;br /&gt;};&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;Does that make any sense? I&#039;m trying to streamline this so I don&#039;t have to rewrite too many functions... or maybe I could create a function with the whole thing .... hmm....&lt;/p&gt;
&lt;p&gt;This is the page I&#039;m working with BTW:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.housing.uwaterloo.ca/tempages/moving-late.html&quot; class=&quot;bb-url&quot;&gt;http://www.housing.uwaterloo.ca/tempages/moving-late.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(it may be in various states of disrepair when you access it - trying to get this to work if there are more than one tooltip on the page without rewriting whole chunks of javascript for each one)&lt;/p&gt;
 </description>
     <pubDate>Mon, 09 Jul 2007 16:33:27 +0000</pubDate>
 <dc:creator>Megan</dc:creator>
 <guid isPermaLink="false">comment 1221406 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/how-do-i-use-addevent-script#comment-1221254</link>
    <description> &lt;p&gt;Yes. I have looked into the Yahoo library. My conclusion is that, unless you are using a &lt;strong&gt;lot&lt;/strong&gt; of JavaScript effects etc. on a page, the Yahoo library is a bit of overkill.&lt;/p&gt;
&lt;p&gt;Ultimately, it&#039;s a design choice. Like most design choices, it&#039;s a matter of compromise, rather than there being a single, &quot;correct&quot; solution. &quot;Yer pays yer money ...&quot;&lt;/p&gt;
 </description>
     <pubDate>Thu, 05 Jul 2007 18:22:24 +0000</pubDate>
 <dc:creator>webwiz</dc:creator>
 <guid isPermaLink="false">comment 1221254 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/how-do-i-use-addevent-script#comment-1221206</link>
    <description> &lt;p&gt;Thanks David! I&#039;ve seen many versions of this script that claim to be better than the others but I&#039;m not sure which is the &quot;best&quot; one (especially since I don&#039;t need to support old browsers.) Even the one you linked to has a follow-up recommending a different method:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.dustindiaz.com/yahoo-event-utility/&quot; class=&quot;bb-url&quot;&gt;http://www.dustindiaz.com/yahoo-event-utility/&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Wed, 04 Jul 2007 19:28:24 +0000</pubDate>
 <dc:creator>Megan</dc:creator>
 <guid isPermaLink="false">comment 1221206 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/how-do-i-use-addevent-script#comment-1221201</link>
    <description> &lt;p&gt;You are almost there with your first version, Megan.&lt;/p&gt;
&lt;p&gt;Instead of passing &quot;alert(&#039;somethinghere&#039;)&quot; as your third argument, pass the name of an actual function. Viz:&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;function myFun() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(&amp;#039;somethinghere&amp;#039;);&lt;br /&gt;}&lt;br /&gt;window.onload=function() {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; addEvent(document.getElementById(&amp;#039;datehelpicon&amp;#039;), &amp;#039;click&amp;#039;, myFun);&lt;br /&gt;};&lt;/code&gt;&lt;/div&gt;&#039;&lt;br /&gt;
Note that this version of addEvent fails in IE5 Mac. You probably don&#039;t care about that poor old thing, but here is the latest version that I know about, which has the added feature of retaining the &quot;this&quot; keyword in IE (Windows and Mac):&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.dustindiaz.com/rock-solid-addevent/&quot; class=&quot;bb-url&quot;&gt;http://www.dustindiaz.com/rock-solid-addevent/&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Wed, 04 Jul 2007 18:17:41 +0000</pubDate>
 <dc:creator>webwiz</dc:creator>
 <guid isPermaLink="false">comment 1221201 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
