eni
eni

Reputation: 695

How can i apply more than 1 style on web page

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

Upvotes: 0

Views: 104

Answers (3)

Moe Salih
Moe Salih

Reputation: 723

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.

Upvotes: 0

CaffGeek
CaffGeek

Reputation: 22054

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"

Upvotes: 0

Yi Jiang
Yi Jiang

Reputation: 50105

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

Upvotes: 2

Related Questions