Given a stylesheet with various rules, some of them being for hyperlinks, I would like to present each rule (only those containing "a" tags) along with the current value for "color" to allow the end user to click on a colorpicker widget and change the color. Using jQuery Ajax with PHP to save the updated color back to the stylesheet.
For example, the stylesheet might have the following content...
body {some rules here}
.header {more rules}
.menu a {color:#800000; text-decoration:none;}
.sidebar a {color:red;}
.footer a, .开发者_如何学JAVAcontent a {color:#fff}
So I would like to present a fieldset back to the end user into which each "a" rule would be listed along with an input box showing the current value for its "color" value. When clicked, the color value would open a small colorpicker widget (again jQuery) which would be preset to reflect the current value and allow the user to choose a new value. Once chosen, the value would be written back to the stylesheet via a jQuery ajax call.
Link Colors:
Menu Color: #800000 [edit]
Sidebar Color: #ff0000 [edit]
Footer Color: #ffffff [edit]
Content Color: #ffffff [edit]
Where the [edit] button opens a colorpicker to change the color for that class assignment and open clicking "Apply" on the colorpicker, writes the updated value to the stylesheet...
This project might be of interest
I realize this is an old post but if you want to process styles based on a set of rules you might want to look and keeping your styles in a table and using dynamic CSS (Processing it as PHP). Can encapsulate everything in a class to keep it fairly clean.
Blake
精彩评论