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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS changed in JavaScript: how do I save?

Status
Not open for further replies.

terraman

Programmer
May 26, 2003
12
NL
Hi,

I have a page where I want to change my CSS using JavaScript.
I attached an external CSS and read it out using

var CSS = document.styleSheets[0];

Now I can do everything I want with it (using getelementByID, AddRule etc. (I do it by using a button click and an input field)

But as soon as I refresh my changes are lost and I can't find a save function in the StyleSheet object.

Any help on this problem would be highly apreciated.

Johannes
 

Read: thread216-832129

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
I've read it, but that example uses another external stylesheet and overwrites the original with the new one using href... But I haven't got another css file, only a JavaScript object
 
?

You are looking to make permanent changes to a file on the server? Not possible using JavaScript.

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
So, conclusion, it's impossible to save all the css adjustments you made in JavaScript?
 
You could store the style sheet on the client machine using cookies then check for the cookie when a user comes to the site, and apply that style if it is found...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
I should have known it's not possible to change a server side sheet on the client side.. my mistake.

but you have document.write, but that's only mime html?
 
document.write is temporary - I guess that's what you are calling mime HTML.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top