views:

64

answers:

3

Hello . I have a drop down list with item: style1 , style2 ,style3 ... THis style are external style. I want to know how to apply this syle in my site when i clik on drop down list. Please help me

A: 

You can give your link an id, then use document.getElementById to retrieve it, and change it's href

This site has an example http://www.thesitewizard.com/javascripts/change-style-sheets.shtml

Or just Google for "Change css with Javascript"

Chad
please can you help me with an example
eni
+2  A: 

May I suggest, an oldie but a goodie, http://www.alistapart.com/articles/alternate/, and the updated version, http://www.alistapart.com/articles/bodyswitchers/.

Yi Jiang
A: 

another solution without actually changing the css in javascript is to give the body different css classes and have the formats for those classes in the same css file or multiple css files (up to you). when the user the selects the style from the dropdown, change the class of the body which will change the style of the entire page if the css is written properly.

Moe Salih