By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,814 Members | 2,162 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,814 IT Pros & Developers. It's quick & easy.

Permanently changing Stylesheet using Javascript

P: n/a
Hi,

I would like to be able to write some code in Javascript preferably
(PHP is also all right) which allows the admin of a website to be able
to change stylesheet attributes from a GUI browser interface without
having them to change the text file themselves. (i.e., working on the
supposition that the admin is IT illiterate). Simple things like
table heading colours, backgrounds, font sizes need to be changed this
way.

The browser should then read from the changed textfile the next time
the site is refreshed and it should therefore be permanent. Is this
at all possible? If so, how do I update the textfile?

Any help would be appreciated.

Many thanks,

Jacqueline
Jul 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Jacqueline hu kiteb:
Hi,

I would like to be able to write some code in Javascript preferably
(PHP is also all right) which allows the admin of a website to be able
to change stylesheet attributes from a GUI browser interface without
having them to change the text file themselves. (i.e., working on the
supposition that the admin is IT illiterate). Simple things like
table heading colours, backgrounds, font sizes need to be changed this
way.

The browser should then read from the changed textfile the next time
the site is refreshed and it should therefore be permanent. Is this
at all possible? If so, how do I update the textfile?


Cant be done in javascript. Javascript cant write to a file (except in
cookies), although it can generate text which can then be c&p into a
text file.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #2

P: n/a
Shame it cannot be done in Javascript, but I guess I understand the
reasons for this - being a client side language I guess the security
risk would be huge!!

Have been looking at doing it in PHP, and have come up with two
distinct ways of doing this:-

1) PHP creates stylesheet text file based on entries on form on
webpage.
2) MySQL database table stores key/value pairs for stylesheet
attributes, then a function goes through the table and creates the
stylesheet on the fly (i.e., every webpage needing the stylesheet runs
the function at the top).

Any suggestions on which would be the most efficient/easiest to
implement etc. (or any other ideas on how to do this!!) ?

Many thanks,

Jacqueline

"Fabian" <la****@hotmail.com> wrote in message news:<br************@ID-174912.news.uni-berlin.de>...
Jacqueline hu kiteb:
Hi,

I would like to be able to write some code in Javascript preferably
(PHP is also all right) which allows the admin of a website to be able
to change stylesheet attributes from a GUI browser interface without
having them to change the text file themselves. (i.e., working on the
supposition that the admin is IT illiterate). Simple things like
table heading colours, backgrounds, font sizes need to be changed this
way.

The browser should then read from the changed textfile the next time
the site is refreshed and it should therefore be permanent. Is this
at all possible? If so, how do I update the textfile?


Cant be done in javascript. Javascript cant write to a file (except in
cookies), although it can generate text which can then be c&p into a
text file.
--

Jul 20 '05 #3

P: n/a
Jacqueline wrote:
Shame it cannot be done in Javascript, but I guess I understand the
reasons for this - being a client side language
No, and Fabian's answer was incorrect. It *can* be done with JavaScript.
However, it *cannot* be done with *client-side* JavaScript.
I guess the security risk would be huge!!


Exactly.
PointedEars
Jul 20 '05 #4

P: n/a
On 12 Dec 2003 08:27:23 -0800, ja*******@hotmail.com (Jacqueline)
wrote:
Hi,

I would like to be able to write some code in Javascript preferably


Jacqueline

Check my site, got to the controlpanel,
and see it this is what you want ....

--

find clausen
www.photopress.dk
Jul 20 '05 #5

P: n/a
You can do this using server-side javascript (eg. with ASP).
By using an include file that keeps the style sheet,
user can be allowed to change it by posting info from a form.
Kien
Jul 20 '05 #6

P: n/a
Jacqueline,

If it's the admin, why don't he/she just upload a new stylesheet file?
You said the person must be "IT illiterate" so I think you can assume he/she
can write CCS files. Am I right?
If you don't want the admin to change all posible style things (table width
etc.)
Just make two stylesheets and let him/her only edit one (and load that one
first).

Wouter
Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.