<?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: The Ultimate getElementsByClassName</title>
	<atom:link href="http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/feed/" rel="self" type="application/rss+xml" />
	<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/</link>
	<description>Web development and Internet trends</description>
	<lastBuildDate>Thu, 18 Mar 2010 15:37:38 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-609394</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Sun, 08 Nov 2009 22:49:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-609394</guid>
		<description>Heinz,

You need to escape the script properly to post it in a comment (although a public URL where it can be viewwd is much more preferable).

Either way, you should really be using &lt;a href=&quot;http://robertnyman.com/2008/05/27/the-ultimate-getelementsbyclassname-anno-2008/&quot; rel=&quot;nofollow&quot;&gt;a later version of the script&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Heinz,</p>
<p>You need to escape the script properly to post it in a comment (although a public URL where it can be viewwd is much more preferable).</p>
<p>Either way, you should really be using <a href="http://robertnyman.com/2008/05/27/the-ultimate-getelementsbyclassname-anno-2008/" rel="nofollow">a later version of the script</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heinz Stapff</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608980</link>
		<dc:creator>Heinz Stapff</dc:creator>
		<pubDate>Thu, 05 Nov 2009 20:05:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608980</guid>
		<description>THE ONE THAT DID ONLY SHOWS HALF? I PUT &amp; L T  ; AT THE BEGINING OF THE SCRIPT AND &amp; G T ; AT THE END?</description>
		<content:encoded><![CDATA[<p>THE ONE THAT DID ONLY SHOWS HALF? I PUT &amp; L T  ; AT THE BEGINING OF THE SCRIPT AND &amp; G T ; AT THE END?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heinz Stapff</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608978</link>
		<dc:creator>Heinz Stapff</dc:creator>
		<pubDate>Thu, 05 Nov 2009 20:01:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608978</guid>
		<description>HAY I USED &amp; L T AT THE BEGINING OF EVERY LINE OF SCRIPT AND &amp; G T AT THE END OF EVERY LINE BUT IT DOESN&#039;T LOOK LIKE THE POST MADE IT.</description>
		<content:encoded><![CDATA[<p>HAY I USED &amp; L T AT THE BEGINING OF EVERY LINE OF SCRIPT AND &amp; G T AT THE END OF EVERY LINE BUT IT DOESN&#8217;T LOOK LIKE THE POST MADE IT.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heinz Stapff</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608962</link>
		<dc:creator>Heinz Stapff</dc:creator>
		<pubDate>Thu, 05 Nov 2009 18:23:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608962</guid>
		<description>&lt;&lt; for
function getElementsByClassName(oElm, strTagName, strClassName){	
var arrElements = (strTagName == &quot;*&quot; &amp;&amp; oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
strClassName = strClassName.replace(/\-/g, &quot;\\-&quot;);	
var oRegExp = new RegExp(&quot;(^&#124;\\s)&quot; + strClassName + &quot;(\\s&#124;$)&quot;);	
var oElement;	
for(var i=0; i.</description>
		<content:encoded><![CDATA[<p>&lt;&lt; for<br />
function getElementsByClassName(oElm, strTagName, strClassName){<br />
var arrElements = (strTagName == &quot;*&quot; &amp;&amp; oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);<br />
var arrReturnElements = new Array();<br />
strClassName = strClassName.replace(/\-/g, &quot;\\-&quot;);<br />
var oRegExp = new RegExp(&quot;(^|\\s)&quot; + strClassName + &quot;(\\s|$)&quot;);<br />
var oElement;<br />
for(var i=0; i.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heinz Stapff</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608957</link>
		<dc:creator>Heinz Stapff</dc:creator>
		<pubDate>Thu, 05 Nov 2009 18:11:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608957</guid>
		<description>I JUST TRIED POSTING THE SCRIPT AGAIN USING



SCRIPT



BUT I DON&#039;T SEE IT POSTED. MY SITE IS STILL IN MY DOCUMENTS FOLDER.</description>
		<content:encoded><![CDATA[<p>I JUST TRIED POSTING THE SCRIPT AGAIN USING</p>
<p>SCRIPT</p>
<p>BUT I DON&#8217;T SEE IT POSTED. MY SITE IS STILL IN MY DOCUMENTS FOLDER.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608947</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Thu, 05 Nov 2009 17:20:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608947</guid>
		<description>Heinz,

I really can&#039;t say why the rest of your code doesn&#039;t work, especially not when I can&#039;t see it. This function works to select elements with a certain class.

To be able to even have a chance to say what&#039;s wrong, you need to post a URL to where I can see your code in action.</description>
		<content:encoded><![CDATA[<p>Heinz,</p>
<p>I really can&#8217;t say why the rest of your code doesn&#8217;t work, especially not when I can&#8217;t see it. This function works to select elements with a certain class.</p>
<p>To be able to even have a chance to say what&#8217;s wrong, you need to post a URL to where I can see your code in action.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heinz Stapff</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608939</link>
		<dc:creator>Heinz Stapff</dc:creator>
		<pubDate>Thu, 05 Nov 2009 16:05:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608939</guid>
		<description>SORRY I GET THE BUTTON ELEMENTS WITH GETELEMENTS BY CLASS
USING ***VAR BUTTON=GET*** WITHOUT DOCUMENT?
THEN USE THE ADD EVENT TO ADD THE EVENT TO THE BUTTON. ONLY THING IS THAT THE GET USES OEL FOR ELEMENT? AND THE ADD USES EL?</description>
		<content:encoded><![CDATA[<p>SORRY I GET THE BUTTON ELEMENTS WITH GETELEMENTS BY CLASS<br />
USING ***VAR BUTTON=GET*** WITHOUT DOCUMENT?<br />
THEN USE THE ADD EVENT TO ADD THE EVENT TO THE BUTTON. ONLY THING IS THAT THE GET USES OEL FOR ELEMENT? AND THE ADD USES EL?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heinz Stapff</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608938</link>
		<dc:creator>Heinz Stapff</dc:creator>
		<pubDate>Thu, 05 Nov 2009 15:40:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608938</guid>
		<description>THANKS ROBERT I&#039;LL TRY IT AGAIN TODAY. I&#039;M ALSO GUESSING THAT OEL
IS CLASHING WITH EL IN MY ADDEVENT HANDLER. I&#039;M HAVING A HARD TIME WITH POSTING SCRIPT WITH &amp; LT FOR ETC.</description>
		<content:encoded><![CDATA[<p>THANKS ROBERT I&#8217;LL TRY IT AGAIN TODAY. I&#8217;M ALSO GUESSING THAT OEL<br />
IS CLASHING WITH EL IN MY ADDEVENT HANDLER. I&#8217;M HAVING A HARD TIME WITH POSTING SCRIPT WITH &amp; LT FOR ETC.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608441</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Mon, 02 Nov 2009 08:47:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608441</guid>
		<description>Yngve,

Thanks! :-)</description>
		<content:encoded><![CDATA[<p>Yngve,</p>
<p>Thanks! <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yngve</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608427</link>
		<dc:creator>Yngve</dc:creator>
		<pubDate>Mon, 02 Nov 2009 07:08:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608427</guid>
		<description>Great function!
Thanks.
(Made by a Swede, naturally ;) ;) )</description>
		<content:encoded><![CDATA[<p>Great function!<br />
Thanks.<br />
(Made by a Swede, naturally <img src='http://robertnyman.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  <img src='http://robertnyman.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608211</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Sat, 31 Oct 2009 23:30:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608211</guid>
		<description>Heinz,

This function does not add anything to an element, it&#039;s just a way to select them.

About your problems with IE: my guess is that you have called the function through &lt;code&gt;document.getElementsByClassName&lt;/code&gt;, and not &lt;code&gt;getElemenetsByClassName&lt;/code&gt;, so you don&#039;t get any references back to the element.

If you have a URL to a sample, please add it here.</description>
		<content:encoded><![CDATA[<p>Heinz,</p>
<p>This function does not add anything to an element, it&#8217;s just a way to select them.</p>
<p>About your problems with IE: my guess is that you have called the function through <code>document.getElementsByClassName</code>, and not <code>getElemenetsByClassName</code>, so you don&#8217;t get any references back to the element.</p>
<p>If you have a URL to a sample, please add it here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heinz Stapff</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608189</link>
		<dc:creator>Heinz Stapff</dc:creator>
		<pubDate>Sat, 31 Oct 2009 22:15:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608189</guid>
		<description>Sorry I can&#039;t add/attach events to &#039;a&#039; link in Table Row  Table &#039;cell&#039; to delete the row onclick with getelementbyclassname in IE. My guess is that IE dose not allow the class refrence to affect the table. Without the ability to do so I remain dumbfounded. I also assume that because the ultimate can&#039;t access the &#039;a&#039; in an IE table row &#039;cell&#039;, it falls short of ultimate and unobtrusive javascript has a while to go??????</description>
		<content:encoded><![CDATA[<p>Sorry I can&#8217;t add/attach events to &#8216;a&#8217; link in Table Row  Table &#8216;cell&#8217; to delete the row onclick with getelementbyclassname in IE. My guess is that IE dose not allow the class refrence to affect the table. Without the ability to do so I remain dumbfounded. I also assume that because the ultimate can&#8217;t access the &#8216;a&#8217; in an IE table row &#8216;cell&#8217;, it falls short of ultimate and unobtrusive javascript has a while to go??????</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Heinz Stapff</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608000</link>
		<dc:creator>Heinz Stapff</dc:creator>
		<pubDate>Fri, 30 Oct 2009 21:49:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-608000</guid>
		<description>Looking at the getelementsbyclassname again it looks like it is adding a class name to the id attribute. I don&#039;t know if that means I don&#039;t have to add the class= to the html or not? I have the &#039;a&#039; tag writen as...
id=&quot;removeitem&quot; class=&quot;removeitem&quot;????????????</description>
		<content:encoded><![CDATA[<p>Looking at the getelementsbyclassname again it looks like it is adding a class name to the id attribute. I don&#8217;t know if that means I don&#8217;t have to add the class= to the html or not? I have the &#8216;a&#8217; tag writen as&#8230;<br />
id=&#8221;removeitem&#8221; class=&#8221;removeitem&#8221;????????????</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: getElementsBy* &#171; Dogfeeds——IT Telescope</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-589287</link>
		<dc:creator>getElementsBy* &#171; Dogfeeds——IT Telescope</dc:creator>
		<pubDate>Sat, 13 Jun 2009 05:57:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-589287</guid>
		<description>[...] getElementsByClassName [...]</description>
		<content:encoded><![CDATA[<p>[...] getElementsByClassName [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-577404</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Fri, 24 Apr 2009 16:22:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-577404</guid>
		<description>Tony,

Start by using the new version, linked to at the top of this page. If it fails, please provide a URL to a test page.</description>
		<content:encoded><![CDATA[<p>Tony,</p>
<p>Start by using the new version, linked to at the top of this page. If it fails, please provide a URL to a test page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-577394</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Fri, 24 Apr 2009 16:06:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-577394</guid>
		<description>&lt; span class=&quot;abuse bad-Browser&quot; style=&quot;display: none;&quot;&gt; onething
&lt; span class=&quot;abuse good-Browser&quot; style=&quot;display: block;&quot;&gt; another thing

This is part of the span code I want to alternately show/ hide.
Sorry about not paying attention to the HTML instructions</description>
		<content:encoded><![CDATA[<p>&lt; span class=&#8221;abuse bad-Browser&#8221; style=&#8221;display: none;&#8221;&gt; onething<br />
&lt; span class=&#8221;abuse good-Browser&#8221; style=&#8221;display: block;&#8221;&gt; another thing</p>
<p>This is part of the span code I want to alternately show/ hide.<br />
Sorry about not paying attention to the HTML instructions</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-577390</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Fri, 24 Apr 2009 16:03:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-577390</guid>
		<description>The editor cut this part off (I think)
     &lt;a&gt;Report abuse&lt;/a&gt;
            &lt;a href=&quot;showdiv(&#039;comment${comment.commentID}Menu&#039;);&quot; rel=&quot;nofollow&quot;&gt;Report Abuse&lt;/a&gt; </description>
		<content:encoded><![CDATA[<p>The editor cut this part off (I think)<br />
     <a>Report abuse</a><br />
            <a href="showdiv('comment${comment.commentID}Menu');" rel="nofollow">Report Abuse</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-577389</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Fri, 24 Apr 2009 16:02:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-577389</guid>
		<description>I am not sure what I am doing wrong here, but what I am trying to do is to is to detect a browser and version (which I can do) and then switch off and on between the two spans.


     
      
      var myBrowserVersion;
       myBrowserVersion = parseInt(BrowserDetect.version);
      //Detect if visitor is using Firefox 2 (less that version 3)
      //If so just use a mailto method to send email.
      //Otherwise use the abuse form
 
  

      if (BrowserDetect.browser == &quot;Firefox&quot;){ 
           //BrowserDetect.browser == &quot;Firefox&quot; &amp;&amp; myBrowserVersion &lt; 3
         var badBrowser = getElementsByClassName(&quot;bad-Browser&quot;); 
         for(i = 0; i &lt; badBrowser.length; i++) {
            badBrowser.style.display = &quot;none&quot;;
            goodBrowser.style.display = &quot;block&quot;;
            }

   }else {
        var goodBrowser = getElementsByClassName(&quot;good-Browser&quot;); 
        for(i = 0; i &lt; goodBrowser.length; i++) {
           badBrowser.style.display = &quot;block&quot;;
           goodBrowser.style.display = &quot;none&quot;;
           }

    }   
   


            &lt;a&gt;Report abuse&lt;/a&gt;
            &lt;a href=&quot;showdiv(&#039;comment${comment.commentID}Menu&#039;);&quot; rel=&quot;nofollow&quot;&gt;Report Abuse&lt;/a&gt; </description>
		<content:encoded><![CDATA[<p>I am not sure what I am doing wrong here, but what I am trying to do is to is to detect a browser and version (which I can do) and then switch off and on between the two spans.</p>
<p>      var myBrowserVersion;<br />
       myBrowserVersion = parseInt(BrowserDetect.version);<br />
      //Detect if visitor is using Firefox 2 (less that version 3)<br />
      //If so just use a mailto method to send email.<br />
      //Otherwise use the abuse form</p>
<p>      if (BrowserDetect.browser == &#8220;Firefox&#8221;){<br />
           //BrowserDetect.browser == &#8220;Firefox&#8221; &amp;&amp; myBrowserVersion &lt; 3<br />
         var badBrowser = getElementsByClassName(&#8220;bad-Browser&#8221;);<br />
         for(i = 0; i &lt; badBrowser.length; i++) {<br />
            badBrowser.style.display = &#8220;none&#8221;;<br />
            goodBrowser.style.display = &#8220;block&#8221;;<br />
            }</p>
<p>   }else {<br />
        var goodBrowser = getElementsByClassName(&#8220;good-Browser&#8221;);<br />
        for(i = 0; i &lt; goodBrowser.length; i++) {<br />
           badBrowser.style.display = &#8220;block&#8221;;<br />
           goodBrowser.style.display = &#8220;none&#8221;;<br />
           }</p>
<p>    }   </p>
<p>            <a>Report abuse</a><br />
            <a href="showdiv('comment${comment.commentID}Menu');" rel="nofollow">Report Abuse</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-526757</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Wed, 18 Feb 2009 09:02:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-526757</guid>
		<description>toniL,

My initial feedback would be that you shouldn&#039;t overwrite the native &lt;code&gt;document.getElementsByClassName&lt;/code&gt; in web browsers if it already exists, but rather utilize it.</description>
		<content:encoded><![CDATA[<p>toniL,</p>
<p>My initial feedback would be that you shouldn&#8217;t overwrite the native <code>document.getElementsByClassName</code> in web browsers if it already exists, but rather utilize it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: toniL</title>
		<link>http://robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-526755</link>
		<dc:creator>toniL</dc:creator>
		<pubDate>Wed, 18 Feb 2009 08:55:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/#comment-526755</guid>
		<description>hi,

i&#039;ve wrote an getElementsByClassName too.
Are there any improvement suggestions? 

you can call it these ways:
var myObj = document.getElementsByClassName([&#039;foo&#039;, &#039;bar&#039;], &#039;a&#039;);
var myObj = document.getElementsByClassName([&#039;foo&#039;, &#039;bar&#039;]);
var myObj = document.getElementsByClassName(&#039;foo&#039;, &#039;a&#039;);
var myObj = document.getElementsByClassName(&#039;foo&#039;);

document.getElementsByClassName = function(cl,elem){
  var elementsByClassName = [];  
  var regExpString = &#039;&#039;;
  
  if(typeof(elem) == &#039;undefined&#039;) elem = &#039;*&#039;;
  
  if(typeof(cl) == &#039;object&#039;){
    var countOfCl = cl.length;
    var OR = &quot;&#124;&quot;;
    
    for(var k=0; k &lt; cl.length; k++){
      countOfCl--;      
      if(countOfCl == 0) OR = &#039;&#039;;
      
      regExpString += &#039;\\b&#039;+cl[k]+&#039;\\b&#039;+OR;
    }
  }else{
    regExpString = &#039;\\b&#039;+cl+&#039;\\b&#039;;
  }
    
  var regExpString = new RegExp(regExpString);

  var elements = this.getElementsByTagName(elem);
  for (var i = 0; i &lt; elements.length; i++) {
    var className = elements[i].className;
    if (regExpString.test(className)) elementsByClassName.push(elements[i]);
  }
  
  return elementsByClassName;
}; 

Greetings from Berlin
toni</description>
		<content:encoded><![CDATA[<p>hi,</p>
<p>i&#8217;ve wrote an getElementsByClassName too.<br />
Are there any improvement suggestions? </p>
<p>you can call it these ways:<br />
var myObj = document.getElementsByClassName(['foo', 'bar'], &#8216;a&#8217;);<br />
var myObj = document.getElementsByClassName(['foo', 'bar']);<br />
var myObj = document.getElementsByClassName(&#8216;foo&#8217;, &#8216;a&#8217;);<br />
var myObj = document.getElementsByClassName(&#8216;foo&#8217;);</p>
<p>document.getElementsByClassName = function(cl,elem){<br />
  var elementsByClassName = [];<br />
  var regExpString = &#8221;;</p>
<p>  if(typeof(elem) == &#8216;undefined&#8217;) elem = &#8216;*&#8217;;</p>
<p>  if(typeof(cl) == &#8216;object&#8217;){<br />
    var countOfCl = cl.length;<br />
    var OR = &#8220;|&#8221;;</p>
<p>    for(var k=0; k &lt; cl.length; k++){<br />
      countOfCl&#8211;;<br />
      if(countOfCl == 0) OR = &#8221;;</p>
<p>      regExpString += &#8216;\\b&#8217;+cl[k]+&#8217;\\b&#8217;+OR;<br />
    }<br />
  }else{<br />
    regExpString = &#8216;\\b&#8217;+cl+&#8217;\\b&#8217;;<br />
  }</p>
<p>  var regExpString = new RegExp(regExpString);</p>
<p>  var elements = this.getElementsByTagName(elem);<br />
  for (var i = 0; i &lt; elements.length; i++) {<br />
    var className = elements[i].className;<br />
    if (regExpString.test(className)) elementsByClassName.push(elements[i]);<br />
  }</p>
<p>  return elementsByClassName;<br />
}; </p>
<p>Greetings from Berlin<br />
toni</p>
]]></content:encoded>
	</item>
</channel>
</rss>
