Quick Search
Sunbelthost Hosting - Colocation and Dedicated Servers

Threads: 21,763
Posts: 83,205
Members: 24,315
Newest member: joemccue

Web Hosting


 
  #1  
Old 13 Mar 2010, 03:00 PM
carsonkahn carsonkahn is offline
New Member: Posts Will Be Moderated
 
Join Date: Mar 2010
Posts: 1
Unhappy Help on style switch?

I'm a bit of a noob here-- so i made this page http://dl.dropbox.com/u/3587374/dark/index.html (BEST in safar or chrome please) and it switchs to a light varient in lower right but via hyperlink, i need to be able to do it with javascript or something... can someone help me out? yes, i've looked at some of the methods on the internet. they seem convoluted. i don't have much experience with js, only html and css so i can't figure this out. help please?
Reply With Quote
  #2  
Old 14 Mar 2010, 02:00 AM
Corrosive's Avatar
Corrosive Corrosive is offline
Established Member
 
Join Date: Apr 2009
Location: Bristol, U.K.
Posts: 748
I did this a while back with a jquery stylesheet switcher; http://corrosiveonline.co.uk/_projec...itch/page1.htm The original code is by Kelvin Luck at; http://www.kelvinluck.com/2006/05/sw...s-with-jquery/ Good luck
__________________
Corrosive
Multi-method cat-skinning a speciality

Bristol Web and Graphic Design / Bristol IT Support / Corrosive Online
Reply With Quote
  #3  
Old 14 Mar 2010, 01:42 PM
sandman64's Avatar
sandman64 sandman64 is offline
Established Member
 
Join Date: Jan 2010
Posts: 113
In the html header you would have a link to your stylesheet (with an ID value) like this:

Code:
<link rel="stylesheet" href="style1.css" id="stylesheet">
Also in the header, you would create this javascript code:

Code:
<script type="text/javascript">
<!--
function changeStyles() {
document.getElementById("stylesheet").href = "style2.css";
}
//-->
</script>
Then, on the button you click on the site to change the stylesheet, you would include this code inside the button/image/whatever they're clicking on:

Code:
onClick="changeStyles();"
Reply With Quote
Reply

Tags
css, html, javascript help, page, style

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
list style gauri_agr Web Design, HTML Reference and CSS 4 06 Jan 2010 01:01 PM
A Couple Newbie Questions about Div & Heights Vance Web Design, HTML Reference and CSS 2 08 Dec 2008 09:15 PM
javascript to switch style sheet? electrickeye Web Design, HTML Reference and CSS 1 16 Apr 2008 10:50 AM
Simple guide to CSS Rifat-m6.net Tutorials 3 10 May 2006 10:50 PM


All times are GMT -5. The time now is 01:14 PM.


 

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Forums Copyright © 2004-2010, WebDevForums.com. Web design by Miami Web Design. All Rights Reserved.