|
-
Oct 22nd, 2002, 05:21 AM
#1
Thread Starter
Fanatic Member
Pls help with setting style
Hi,
I have a few thousand elements to which I have a style class assigned ( customdiv ). I would like to change a style property ( fontsize ) of all of these elements at once using scripting. I know I can use a java loop, but this will be really slow. I know that I could also change the className attribute of each element, but 1) this comes back to the slow loop issue, and 2) I would need a million classes for each combination of values.
So what I think I need to do, is find out how to change the class directly using script so that all the elements are changed immediately without the need for nasty loops.
Can anybody help me? If this is not possible, I would like to know that too....
Thanks!
-
Oct 22nd, 2002, 06:16 AM
#2
Fanatic Member
I doubt this is standard but it works.
Right,
1/ Put all stylesheets in external css files.
2/ In the link tag give it an id
e.g
<link id= "stylesheet" href="styles/default.css" rel="stylesheet" type="text/css">
3/ reference the stylesheet, when you want to change it, using document.getElementById and change the href to the second stylesheet location.
e.g
document.getElementById('styleSheet').href = 'styles/default.css';
This will change all classes contained in that stylesheet.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|