By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,723 Members | 1,662 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,723 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Peter King wrote on 10 nov 2003 in
comp.infosystems.www.authoring.stylesheets:
<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)
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.