SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Skinning

  1. #1
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Skinning

    hmm, maybe this isnt a beginner's question eh?

    OH well, here goes.

    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>

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

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

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

    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! Help!

    http://maleko.net/switch.htm is the site.

    Thanks again.
    http://maleko.net

  2. #2
    (****** or Deleted)
    Join Date
    May 2002
    Location
    Melbourne, Australia
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont know much about javascript, but can maybe give some suggestions...

    You will need to use cookies to stor the users choice, again not sure how to do it with javascript but it is pretty easy with php if it is an option...

    I have done skinning for a site that included images as well as colours and using php it was pretty easy... If you want help doing it in php maybe post in that forum, if you want to use js maybe post in the javascript forum?

    As for all style sheets loading at once, I think you would have to choose to only load the default one and then have a different one load when the user clicks the link...

    Oh and your link is down, site is not available...

  3. #3
    SitePoint Member
    Join Date
    Jul 2002
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I dont really know PHP stuff all that well.

    and maybe http://maleko.d2g.com/switch.htm will work. I'm server maleko.net myself, so I guess its kind of slow/doesnt show up sometimes...eek
    http://maleko.net


Bookmarks

Posting Permissions

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