File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Disable/Enable inline style Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Disable/Enable inline style" Watch "Disable/Enable inline style" New topic

Disable/Enable inline style

Reese Doherty

Joined: Dec 07, 2006
Posts: 8

Does anyone know of a way by which I could enable and disable an inline style based on a piece of javascript. I know its possible to do this woth stylesheets but I havent come across a way of doing it with inline styles. I have found a way to disable them by setting style.cssText to an empty string. However there is no way of enabling the style again as it has been removed.

Any help appreciated
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
You would have to remove it than add it back on. You can set another property with the value before you remove it.

Reese Doherty

Joined: Dec 07, 2006
Posts: 8
Would it be possible to remane the style by appending a caracter string and then searching for that string to remove it in order to reenable the style?
I'm not sure at all what functions/properties I can call on style.cssText. I have been able to rename the cssText but i dont know how to search it for the string I appended to it(in order to disable it)....
I agree. Here's the link:
subject: Disable/Enable inline style
It's not a secret anymore!