[SOLVED] CSS Skin

This is a discussion on "[SOLVED] CSS Skin" within the Web Page Design section. This forum, and the thread "[SOLVED] CSS Skin are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 6th, 2007, 08:05
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Question [SOLVED] CSS Skin

Hai everyone,

I just love CSS! My page looks great and neat with CSS.
I just love learning and discover new things with CSS.

Because of that, I have created two CSS for my page, one using a lot of blue, and another one using a lot of purple.

Is there a way for me to change the "skin" of my page by using a drop down menu to select which color (css) I want to view my page?

Yahoo page option looks cool, anybody know how to do that?
Thanks...

Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote

  #2 (permalink)  
Old Sep 7th, 2007, 00:25
AdRock's Avatar
SuperMember

SuperMember
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to AdRock
Re: CSS Skin

I have done something with this for a website I had to make at Uni

It is written in JS but there are php versions but i haven't got the code for that

Basically, in the head section of you page you put
Code: Select all
<link rel="stylesheet" type="text/css" href="includes/default.css" title="default" />
<link rel="alternate stylesheet" type="text/css" href="includes/alternate.css" title="alternate" />
include the JS file like this also in the head section
Code: Select all
<script type="text/javascript" src="includes/styleswitcher.js"></script>
and create some links using images or whatever to switch between stylesheets
Code: Select all
<a href="#" onclick="setActiveStyleSheet('default'); return false;"><img  src="images/default.gif" alt="Default" /></a>
     <a href="#" onclick="setActiveStyleSheet('medium'); return false;"><img  src="images/alternate.gif" alt="Alternate" /></a>
This is styleswitcher.js
Code: Select all
 
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}
function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}
function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}
function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}
window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}
window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
<a href="#" onclick="setActiveStyleSheet('default'); return false;"><img class="access" src="images/small.gif" alt="Default text size" /></a>
Reply With Quote
  #3 (permalink)  
Old Sep 7th, 2007, 02:38
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: CSS Skin

Thanks adrock, nice way.

I found the web tutorial on this topic, similar to your code (with explaination)

CSS Style Switch

Thanks again...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #4 (permalink)  
Old Sep 7th, 2007, 03:37
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: CSS Skin

hey, got any idea how to do the "Yahoo Page Option"? (the drop down selection)

Looks cool...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #5 (permalink)  
Old Sep 7th, 2007, 10:13
AdRock's Avatar
SuperMember

SuperMember
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to AdRock
Re: CSS Skin

Never seen it
Reply With Quote
  #6 (permalink)  
Old Sep 8th, 2007, 02:33
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: CSS Skin

Look at my First post, I have included the print screen for the www.yahoo.com page.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #7 (permalink)  
Old Sep 8th, 2007, 08:02
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,649
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: CSS Skin

Monie, can you not use that as your base for the SS switcher? And then just use images instead of the drop down list?

Also, you will need to find some Javascript... Let me have a look and i will try to build a prototype
Reply With Quote
  #8 (permalink)  
Old Sep 8th, 2007, 08:35
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,649
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: CSS Skin

Ive got the little switcher working.. now to find the dropdown javascript/ajax thing!

http://www.marcfraser.co.uk/monie/
Reply With Quote
  #9 (permalink)  
Old Sep 8th, 2007, 08:52
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,649
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: CSS Skin

Ive got the javascript dropdown thing working although you have to re-click Page Options to close it. Does anyone know how to close it automaticly on mouse click elsewhere on the page?

http://www.marcfraser.co.uk/monie/
Reply With Quote
  #10 (permalink)  
Old Sep 8th, 2007, 10:26
AdRock's Avatar
SuperMember

SuperMember
Join Date: Jul 2006
Location: Devon, England
Posts: 565
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to AdRock
Re: CSS Skin

That is quite nice
Reply With Quote
  #11 (permalink)  
Old Sep 10th, 2007, 05:31
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: CSS Skin

Quote:
Originally Posted by Marc View Post
Ive got the javascript dropdown thing working although you have to re-click Page Options to close it. Does anyone know how to close it automaticly on mouse click elsewhere on the page?
http://www.marcfraser.co.uk/monie/
You are genious Marc!
Well, let sort this out. I tried to see the yahoo page option coding for that drop down option but I was lost somewhere in the middle

So, your design looks almost the same, maybe we could put some "X" (close) inside the drop down page option to close them. Or an "arrow-down" to open the page option, as soon as you click the arrow down it will change to "arrow-up" to close it.

I will try myself, and come back to you if I manage to solve them
Thanks again for your briliant idea.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #12 (permalink)  
Old Sep 10th, 2007, 06:29
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: CSS Skin

You will love this Marc...
I found this interesting LINK for our refference.
I haven't got time to review them.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #13 (permalink)  
Old Sep 10th, 2007, 06:49
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,649
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: CSS Skin

Cool - just have a play about with it!
Reply With Quote
  #14 (permalink)  
Old Sep 11th, 2007, 08:12
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: CSS Skin

Hai Marc,

I couldn't solve that problem. I have tried modified that code to implement your code but couldn't make it success.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #15 (permalink)  
Old Sep 11th, 2007, 19:23
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,649
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: CSS Skin

I will try and play about with it over this weekend although i have school . I will more than likely have time to do it on Sat morning. Hopefully. Unless i have football.
Reply With Quote
  #16 (permalink)  
Old Sep 12th, 2007, 01:20
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: CSS Skin

Quote:
Originally Posted by Marc View Post
I will try and play about with it over this weekend although i have school . I will more than likely have time to do it on Sat morning. Hopefully. Unless i have football.
By the mean time, I'll try to "see" how yahoo did it
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #17 (permalink)  
Old Sep 13th, 2007, 15:32
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,649
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: CSS Skin

Quote:
Originally Posted by monie View Post
By the mean time, I'll try to "see" how yahoo did it
That'll be pretty hard as they are such a big website and just name files with xy and z in them!

Good luck
Reply With Quote
  #18 (permalink)  
Old Sep 14th, 2007, 01:05
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: CSS Skin

Yeah.. I know you would say that! LOL..
Its too complex for me to understand them...
Anyway, good luck with your study and your football this weekend...
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #19 (permalink)  
Old Sep 26th, 2007, 08:43
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Send a message via Yahoo to Monie
Re: CSS Skin

Hey marc, did you notice the way this forumz implimented the javascript coding just like the yahoo page option?

Click on your name in this post next to the "Online" indicator. It is exactly the same that we are trying to archieve.

I'll have a look tonight and get back to you tommorow, see if I could "steal" the code
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #20 (permalink)  
Old Sep 26th, 2007, 15:11
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,649
Thanks: 0
Thanked 8 Times in 8 Posts
Send a message via MSN to Marc Send a message via Skype™ to Marc
Re: CSS Skin

Oh.. Yes, good spot! If you need any hand in finding it, gimme a shout. I have a vBulletin licence and so therefore have all the files.
Reply With Quote
Reply

Tags
skin

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
skin needed smoosh Web Page Design 3 Aug 29th, 2006 16:51
Swamp skin superkooi Web Page Design 5 Nov 30th, 2004 09:33


All times are GMT. The time now is 16:13.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43