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.

Using Classes

Hey all, I know you can reference certain elements buy its ID many different ways! Is it possiblle to do the same with class names? I know I have seen javascript manipulating class names somewhere, .className or something? Thanxs 4 your time1

getElementById is the most direct way to get an object reference when you want a specific Element object corresponding to a unique id. Sometimes you need to get a list or array of all Element objects with something in common - for example all elements whose class attribute contains the string 'content'. The following provides that capability:

If the match method does not find a match, it returns null. If it finds a match, match returns an array, and the properties of the global RegExp object are updated to reflect the results of the match.
The array returned by the match method has three properties, input, index and lastIndex. The input property contains the entire searched string. The index property contains the position of the matched substring within the complete searched string. The lastIndex property contains the position following the last character in the last match.

As you can see, the results of running match() are far more complicated than a simple boolean return.