SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Css Skinning?

  1. #1
    SitePoint Member
    Join Date
    Jul 2002
    0 Post(s)
    0 Thread(s)

    Css Skinning?

    I'm trying to skin my site using severel different .css style sheets. Im using a javascript to allow the loading:

    // Function to change color-scheme
    // Basically switch stylesheet
    function loadStyle(styleNumber)
    if (document.styleSheets)
    // Change 4 to no. of color schemes when modifying
    for (var i=0; i < 4; i++)
    document.styleSheets[i].disabled = (i == styleNumber) ? false : true;


    then, in the head of my html file:

    <link rel="stylesheet" href="css/rightnav.css" type="text/css">
    <script language="JavaScript" type="text/javascript" src="switch.js"></script>

    <style type="text/css">
    @import "css/rightnav.css";

    <style type="text/css">
    @import "css/leftnav.css";

    <style type="text/css">
    @import "css/center.css";

    <style type="text/css">
    @import "/css/.css";

    and finally to load:

    <a href="javascript:loadStyle(1)">rightnav</a>
    <a href="javascript:loadStyle(2)">leftnav</a>
    <a href="javascript:loadStyle(3)">centernav</a>

    Now, for the problem...

    They all load @ the same time! If I could get the rightnav.css to be the only one that loads right away, thatd be PERFECT! But instead, they all load @ once it seems. When you click a link, it goes to the specific .css, everything is fine!

    its the initial load thats troubling me.

    And also, Id like to know how to get the users choice to load each time the visit the site, instead of teh default. For example if they wanted leftnav.css to load, then it would each time they came, instead of them having to choose it each visit.

    Okay. Hope thats not tooo much for one post!

    Just need a .css switching script, and a cookie script to keep the choice. Hope its not too tall an order. is the site.

    Thanks again.

  2. #2
    SitePoint Evangelist
    Join Date
    Oct 2001
    0 Post(s)
    0 Thread(s)
    go to and do a search......they have an article there that should provide you with exactly what you need.....


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts