Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accessing a value in css from javascript

Status
Not open for further replies.

dendenners

Programmer
Jul 17, 2001
110
IE
Hi,
I'm using script.aculo.us for some effects on a site I'm building. One of the effects I'm using is Effect.highlight().
The actual code for this would be (for example)
Code:
<span id="back" class="wide-button" onclick="new Effect.Highlight(this, { startcolor: '#ffffff' })">

When this div is clicked, the color of the span is temporarily changed to white (#ffffff) to indicate to the user that the button that the div represents has indeed been clicked.

Now, my problem is that the startcolor in this instance is hardcoded in each span. I'd like if possible to get this value from a stylesheet. It doesn't seem possible in css to define custom css attributes.

I tried using the javascript getStyle() function, but I can't define a 'startcolor' css attribute, as it is not valid.

Is there some elegant way to pick up css values in javascript?

Thanks
Denis
 
In this case, startcolor is being used as an index to an object - whilst it is setting the "start colour for the transition" this has nothing to do with CSS.

There is no way you can do what you want without reverse-engineering the scriptaclous code and modifying it from there (which is hardly worth the effort).

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top