Free Republic
Browse · Search
News/Activism
Topics · Post Article

Skip to comments.

Web Developing Computer geeks, Lend Me Your Ears: Vanity Question.

Posted on 12/10/2004 2:24:51 PM PST by Conservomax

I have a fairly specific Question for any webhead computer geeks (this incldes myself).

Can anyone tell me of a comprehensive list of attributes for the document.getAttributeById() function in javascript?

Particularly, can anyone tell me how to dynamicly change a css class on a DOM element?

I thought that this would work but oh noooo:

document.getElementById('id').class = "newClass"

or

document.getElementById('id').style.class = "newClass"

Why can't browsers be compatable with my code?


TOPICS: Your Opinion/Questions
KEYWORDS: dhtml; gravimetricflux; javascript
I've posted in computer forums, this site is actually better, there are some hard-core computer geeks here who make me look like a rank amateur.
1 posted on 12/10/2004 2:24:51 PM PST by Conservomax
[ Post Reply | Private Reply | View Replies]

To: Conservomax

Maybe because "newClass" isn't a real class.


2 posted on 12/10/2004 2:27:48 PM PST by palmer ("Oh you heartless gloaters")
[ Post Reply | Private Reply | To 1 | View Replies]

To: Conservomax
Check on w3schools.
3 posted on 12/10/2004 2:28:18 PM PST by xtinct (I was the next door neighbor kid's imaginary friend.)
[ Post Reply | Private Reply | To 1 | View Replies]

To: Conservomax
Did you try changing the classname instead of the class. Just found this:

1. function swapIt(id, newclass) {
2. if (document.getElementById) {
3. if(selected_id != id) {
4. document.getElementById(id).className = newclass;
5. }
6. }
7.}

here Swapping CSS ClassNames
4 posted on 12/10/2004 2:31:11 PM PST by MarkeyD (<a href="http://www.johnkerry.com">Loser</a>)
[ Post Reply | Private Reply | To 1 | View Replies]

To: palmer

That's sample code.


5 posted on 12/10/2004 2:32:29 PM PST by Conservomax (There are no solutions, only trade-offs.)
[ Post Reply | Private Reply | To 2 | View Replies]

To: MarkeyD

Thanks fixed it, something similar.


6 posted on 12/11/2004 4:01:36 PM PST by Conservomax (There are no solutions, only trade-offs.)
[ Post Reply | Private Reply | To 4 | View Replies]

Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.

Free Republic
Browse · Search
News/Activism
Topics · Post Article

FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson