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开发者_StackOverflow社区 drop down list. Please help me
May I suggest, an oldie but a goodie, http://www.alistapart.com/articles/alternate/, and the updated version, http://www.alistapart.com/articles/bodyswitchers/.
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"
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.
精彩评论