Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Browsers / Internet Explorer / August 2004



Tip: Looking for answers? Try searching our database.

how can I change property of all elements of some class?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nikolay I.Nikolskiy - 23 Aug 2004 15:38 GMT
Hello!
I have the following problem.
I have HTML with several elements of some class
<style>
.c1 {font-weight:normal;}
</style>
<span class=c1>text1</span>...
<span class=c1>text2</span>
I need to change dinamically (onclick some button) my class to make its
elements are bold.

is it possible?

Thanks,
Nikolay
Kody Brown - 30 Aug 2004 18:20 GMT
Here's a simple solution

<style>
.c1 {font-weight:normal;}
.c2 {font-weight:bold;}
</style>
<span class=c1 onclick="this.className='c2'">text1</span>...

Here's a mouseover, as well

<span class=c1 onmouseover="this.className='c2'"
onmouseout="this.className='c1'">text2</span>

Signature

-Kody
kody at weekendtech dot net
"Custom ASP.Net Web Controls"

> Hello!
> I have the following problem.
[quoted text clipped - 11 lines]
> Thanks,
> Nikolay
Agoston Bejo - 31 Aug 2004 08:39 GMT
> Here's a simple solution
>
[quoted text clipped - 3 lines]
> </style>
> <span class=c1 onclick="this.className='c2'">text1</span>...

I think what he wanted was that the style of all elements that have class
'c1' change. This way only this particular SPAN element's style will change.
So this won't do.

I couldn't find a solution for this up to now, either, except iterating over
all the elements in the document, checking their className attribute, and
change them where appropriate. This is quite inefficient, though.

> Here's a mouseover, as well
>
[quoted text clipped - 16 lines]
> > Thanks,
> > Nikolay
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.