Mark Drew wrote:
> On a similar note, as I have been doing this *right now* I wonder if
> the fllowing is possible:
> (excuse the pseudocode.
>
> <style>
> .mystyle1 { // some styles here }
> .mystyle2 { //a different stule here }
>
> //now change mystyle1 to mystyle 2
>
> .mystyle1 { //overwrite with mystyle2 }
>
>
>
> </style>
>
> Basically I want to replace the styles in mystyle1 with those in mystyle2
>
> any ideas?
Not in the stylesheet. You can do it through javascript, but
usually I prefer just to change the class of the element instead
of editing the stylesheet. I.e., to add a class to an element if
it doesn't exist and remove it if it does exist I use:
function swapClass(theElement, theClass) {
var classArray = theElement.className.split(/\s+/);
for (var i = 0; i < classArray.length; i++) {
if (classArray[i] == theClass) {
classArray.splice(i, 1);
theElement.className = classArray.join(' ');
return;
}
}
classArray.push(theClass);
theElement.className = classArray.join(' ');
}
Jochem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=36
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182034
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54