HighDots Forums  

class="classA classB" + this.className="classC" means you wiped classA too?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss class="classA classB" + this.className="classC" means you wiped classA too? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Peter King
 
Posts: n/a

Default class="classA classB" + this.className="classC" means you wiped classA too? - 11-10-2003 , 04:48 AM






if you assign multiple classes in order to keep your classes generic
e.g
..classA { position.absolute; left:5 top:5 height:200 width:800 }
..classB { background-color: red}
..classC { background-color: green}

<div id="div1" class="classA classB" ...

but then want to dynamically assign a new class

onMouseOver="this.className='classC'" or onMouseover="changeclass(div1,classC)"

does classC replace BOTH the other classes?

If so can you go:

onMouseOver="this.className='classA classC'"

or what?

can't find any answers to this question via google. thanx

peter

p.s
seems to me that class assignment would be better as an array

eg p."id"[1]=class

also there isn' much scope for encapsulation or inheritance as

Reply With Quote
  #2  
Old   
Evertjan.
 
Posts: n/a

Default Re: class="classA classB" + this.className="classC" means you wiped classA too? - 11-10-2003 , 05:20 AM






Peter King wrote on 10 nov 2003 in
comp.infosystems.www.authoring.stylesheets:

Quote:
div id="div1" class="classA classB" ...

but then want to dynamically assign a new class

onMouseOver="this.className='classC'" or
onMouseover="changeclass(div1,classC)"

does classC replace BOTH the other classes?

try:

==================

<style>
.classA {color:green;width:250px;}
.classB {font-size:20pt;}
.classC {background-color:red;}
</style>

<div class="classA classB"
onMouseOver="this.oldClasses=this.className;this.c lassName+=' classC'"
onMouseOut="this.className=this.oldClasses">
TEST
</div>

<br>

<div class="classA classC"
onMouseOver="this.oldClasses=this.className;this.c lassName+=' classB'"
onMouseOut="this.className=this.oldClasses">
ME
</div>

==================

IE6 tested

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.