Preserved Topic: Applying properties to classes (Page 1 of 1) |
|
---|---|
Bipolar (III) Inmate From: |
posted 07-05-2003 16:16
What is the most efficient way to apply properties, styles ans events to objects with the same classname via javascript? |
Maniac (V) Inmate From: Brisbane, Australia |
posted 07-05-2003 17:17
myClassName = "myClass" |
Bipolar (III) Inmate From: |
posted 07-05-2003 20:33
Thanks. I had done something almost exactly the same but I was hoping there was a way to do it without a loop. |
Bipolar (III) Inmate From: schillmania.com |
posted 07-05-2003 23:26
I'm hoping there'll be a getElementsByClassName() in future versions of JS. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 07-06-2003 00:02
The following is a getElementsByClassName function which I've written for my own use. It gets every single element in the document whose className is set to a specific value. It takes into account that className's may be a space-separated list of classes: |
Bipolar (III) Inmate From: |
posted 07-06-2003 04:21
Thanks Slime. I'll be up all night with that one LOL! |