RE: Slightly OT: Change a stylsheet class via JavaScript?

2002-05-20 Thread Neil Clark - =TMM=

Yes, you can change a CSS style by using Javascript, I cant remember off
the top of my head exactly how but it can be done by referencing the
objects style (or BG) and colour.

item.style.color='#4d4d4d';

and then asking it to change it on mouseover/mouseout.

onMouseOver=colourChange(this,'009933');
onMouseOut=colourChange(this,'66');

where colourChange is your function for manipulation...







Neil Clark
Team Macromedia
http://www.macromedia.com/go/team

Announcing Macromedia MX!! 
http://www.macromedia.com/software/trial/.

-Original Message-
From: Dave Carabetta [mailto:[EMAIL PROTECTED]] 
Sent: 20 May 2002 14:01
To: CF-Talk
Subject: Slightly OT: Change a stylsheet class via JavaScript?

How can I programmatically change a stylesheet class via JavaScript? I'd

like to change the background of a text box from white to red if some
form 
validation fails. I've seen it done before, but haven't been able to
track 
down the code to do it.

Thanks,
Dave.



__
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Slightly OT: Change a stylsheet class via JavaScript?

2002-05-20 Thread Gyrus

- Original Message -
From: Dave Carabetta [EMAIL PROTECTED]


How can I programmatically change a stylesheet class via JavaScript? I'd
like to change the background of a text box from white to red if some
form
validation fails. I've seen it done before, but haven't been able to
track
down the code to do it.


The basic syntax is:

[elementRef].style.[property] = [value];

So for the above example it might be:

document.getElementById(textBox).style.backgroundColor = yellow;

You might have to look into things deeper for cross-browser
functionality - either in terms of referring to elements without
getElementById() or in the actual support for accessing the style
object. But this should get you going :-)

Actually, just reading your post again, you ask about changing the
*class*. I know you can change the declarations with a class somehow
(cssRules?), but as for changing the actual class of an element, that
just rings bells that say Problems! I could well be wrong, though. But
I think the above should be good for your purposes.

- Gyrus


- [EMAIL PROTECTED]
work: http://www.tengai.co.uk
play: http://www.norlonto.net
- PGP key available


__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Slightly OT: Change a stylsheet class via JavaScript?

2002-05-20 Thread Craig Thomas

Is your form validation done in CF or JS?  

-Craig


__
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



Re: Slightly OT: Change a stylsheet class via JavaScript?

2002-05-20 Thread Jon Hall

document.getElementById('textBoxId').className = 'class';


Dave Carabetta wrote:

How can I programmatically change a stylesheet class via JavaScript? I'd 
like to change the background of a text box from white to red if some form 
validation fails. I've seen it done before, but haven't been able to track 
down the code to do it.

Thanks,
Dave.



__
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists



RE: Slightly OT: Change a stylsheet class via JavaScript?

2002-05-20 Thread Dave Carabetta

Is your form validation done in CF or JS?

-Craig

Actually, both...But I'm looking to change the style when I do the JS 
validation up front. The CF validation is really just my fall-back should 
the user have JS disabled or something.

Thanks,
Dave.


__
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists