The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

If I understand correctly I thought target.className would get the class name of the element passed to it, thus I expected to have the function return True, but I consistently get False. I got False whether I put in an element with the class or without it. I then put the alert(target.className) in to see what the value was showing has and I get "Undefined". So presently I am not sure if I am doing something incorrect or it maybe that I don't have a proper understanding of className. Any help would be appreciated.
Thank you.

Thanks Raffles...the further explaination made me realize how my thinking was wrong. In some murky thought I wanted to somehow go thru the dom tree and gather all the nodes with the class specified. By pointing out the various ways to walk the DOM it made me realize I had to collect all the element nodes into an array then test them to get the results I was imagining.

In the future, please use code blocks, preferably with the appropriate syntax highlighting. As you can no doubt see, it makes reading the code a hell of a lot easier.

In your code, there is no point checking for document.all. If you need to use document.all, then you're catering for browsers that practically don't support CSS and for pages that most likely do not use CSS either, and also probably don't use the class attribute either. Ditch it.

Incidentally, here's my throw at a hasClass function, along with a getElementsByClassName that returns the actual elements with that class name: