SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    375
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS Style switcher

    I'm just trying to implement this for the first time, and as far as I can tell have it set up so that it should work, but doesn't seem to be, so I guess I must be doing something wrong somewhere.

    The page is here :

    link here

    So I've uploaded the styleswicher.js file, linked to it in my header, along with two style sheets to try it out :

    HTML Code:
    <link rel="stylesheet" type="text/css" href="standard.css" title="default"/>
    <link rel="alternate stylesheet" type="text/css" href="medium.css" title="medium" />
    <script type="text/javascript" src="/scripts/styleswitcher.js"></script>
    And added in the links to the different styles in the body :

    HTML Code:
    <a href="#" onclick="setActiveStyleSheet(’default’); return false;"><img src="smalla.jpg" alt="View this website in standard text size" border="0" align="absbottom"></a>
    <a href="#" onclick="setActiveStyleSheet('medium'); return false;"><img src="mediuma.jpg" alt="View this website in medium text size" border="0" align="absbottom"></a>
    If anyone could let me know where I'm going wrong, that would be great.

    Cheers.

  2. #2
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by duklaprague View Post
    If anyone could let me know where I'm going wrong, that would be great.
    The error console is doing that:

    illegal character
    [Break on this error] setActiveStyleSheet(’default’); return false;

    You're using the wrong quote character ( ’ ). Use " or '
    Tab-indentation is a crime against humanity.


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
  •