Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Alternate stylesheets - are they working?
Old 09-01-2009, 05:59 PM Alternate stylesheets - are they working?
senemedar's Avatar
Experienced Talker

Posts: 47
Name: Michał
Location: Unitet Kingdom
Trades: 0
Hi everyone!

I was trying to add an alternate stylesheet to my page, so I (or the User) could change between main and this one. The only problem is-- the browsers doesn't seem to see them! When I list the styles for the page in Firefox, there's only main one listed, so the whole switch machinery simply won't work; the same story's for Opera. What is interesting, it does work well with Safari! (And Dreamweaver...)

Here's some of the code, I'm using:

Code:
<link href="main.css" rel="stylesheet" type="text/css" id="default" />
<link href="braz.css" rel="alternate stylesheet" type="text/css" id="alternate" />

<a href="#" onclick="changeStyle()">style sheet</a>
and for changing the styles:
Code:
        function changeStyle() {        
        document.getElementById('default').disabled=true;
        document.getElementById('alternate').disabled=false;
        }
I know the alternate stylesheet is disabled by default, but even when I add disabled="disabled" to second <link>, it still won't work... Where's the error?

ps.
Here's the "live" page, if you're interested:
http://misiu98.republika.pl/willa
(ignore the background-only change, it's for testing purposes only; also ignore IE issues-- I hope I can solve them when I get the whole site working)
__________________

Please login or register to view this content. Registration is FREE

home of senemedar
senemedar is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-02-2009, 05:52 PM Re: Alternate stylesheets - are they working?
portkey's Avatar
Skilled Talker

Posts: 54
Name: Erica Dion
Trades: 0
I'm not completely sure about Firefox and Opera, but I know Microsoft announced that they removed the functionality to disable style sheets in their browser. If you're looking to switch them in javascript, the site below has a good tutorial, it just requires a bit more code and allows cookies so that it can be remembered after they close the browser. If that doesn't work, I usually prefer using PHP and cookies to switch between layouts. A little bit less code.

http://www.alistapart.com/articles/alternate/
__________________
Hysterical Web Design

Please login or register to view this content. Registration is FREE

Fair priced and reliable web design services that complement your website needs
portkey is offline
Reply With Quote
View Public Profile Visit portkey's homepage!
 
Old 09-02-2009, 06:17 PM Re: Alternate stylesheets - are they working?
senemedar's Avatar
Experienced Talker

Posts: 47
Name: Michał
Location: Unitet Kingdom
Trades: 0
Ha! Nailed it!
I forgot to put the title attribute - now it all works nicely. I don't know about the IE though, will try it later.
Thanks for the link, portkey, been very helpful.
__________________

Please login or register to view this content. Registration is FREE

home of senemedar
senemedar is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Alternate stylesheets - are they working?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21788 seconds with 12 queries