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.
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")
To: Conservomax
3
posted on
12/10/2004 2:28:18 PM PST
by
xtinct
(I was the next door neighbor kid's imaginary friend.)
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>)
To: palmer
5
posted on
12/10/2004 2:32:29 PM PST
by
Conservomax
(There are no solutions, only trade-offs.)
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.)
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.
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson