javascript/css problem
Results 1 to 5 of 5

Thread: javascript/css problem

  1. #1
    Senior Member Aardpsymon's Avatar
    Join Date
    Feb 2007
    Location
    St Annes (aaaa!)
    Posts
    434

    javascript/css problem

    ok, so I finally got round to making a more accessible version of our website (high contrast, larger fonts etc). So there I am, bits of java script messing around with a second css file, making a cookie so that the setting is stored and it all works wonderfully.

    That is, in firefox. Not so good in IE. As far as I can tell the error is somewhere in here....

    Code:
    		var defaultSheet=document.getElementById('cahs');
    		var accessibleSheet=document.getElementById('hi');
    		accessibleSheet.disabled=true;
    		
    		function setHighvis(){
    			defaultSheet.disabled=true;
    			accessibleSheet.disabled=false;
    
    		}
    		
    		function setDefault(){
    			accessibleSheet.disabled=true; 
    			defaultSheet.disabled=false;
    		}
    setDefault() works and returns you to the standard style sheet
    setHighvis() only sort of works. It disables the default style but does not enable the high vis. But only for IE, it works fine in firefox. Anyone any ideas?

    Code:
    	<link href="/cahs.css" rel="stylesheet" type="text/css" Title="Default" id="cahs"/>
    	<link href="/hi-vis.css" rel="alternative stylesheet" type="text/css" Title="High Visibility" id="hi"/>
    Code:
    					<a href="#" onclick="setDefault();document.cookie = 'highvis=false; expires=Thu, 2 Aug 2021 20:47:11 UTC; path=/';">Default</a> | 
    					<a href="#" onclick="setHighvis();document.cookie = 'highvis=true; expires=Thu, 2 Aug 2021 20:47:11 UTC; path=/';">High Visibility</a> |
    The cookies work fine, it saves and retrieves status ok. Its just the setting of the high vis sheet that doesn't work.
    If the world doesn't stop annoying me I will name my kids ";DROP DATABASE;" and get revenge.

  2. #2
    Senior Member JPnyc's Avatar
    Join Date
    Jan 2005
    Posts
    2,734
    Try using isDisabled, as suggested here

    http://msdn2.microsoft.com/en-us/library/ms535871.aspx

  3. #3
    Senior Member Aardpsymon's Avatar
    Join Date
    Feb 2007
    Location
    St Annes (aaaa!)
    Posts
    434
    I tried that, didn't work. I did solve it though. The problem was with my linking of style sheets. Heres why its important to take regular breaks when coding kids,

    rel="alternative stylesheet"
    is not the same as
    rel="alternate stylesheet"

    *D'oh!*

    I had a feeling it was something idiot like that, which is why I posted. Second pair of eyes and all.

    Thanks J.
    If the world doesn't stop annoying me I will name my kids ";DROP DATABASE;" and get revenge.

  4. #4
    Senior Member JPnyc's Avatar
    Join Date
    Jan 2005
    Posts
    2,734

  5. #5
    Senior Member Aardpsymon's Avatar
    Join Date
    Feb 2007
    Location
    St Annes (aaaa!)
    Posts
    434
    might switch to that at some point, but this works and I don't feel like breaking it right now :P

    Reason I did it that way is because thats what came up first on google. well, that worked anyway.
    If the world doesn't stop annoying me I will name my kids ";DROP DATABASE;" and get revenge.

Similar Threads

  1. The Problem Saga Continues
    By The Texan in forum Operating Systems
    Replies: 16
    Last Post: June 22nd, 2006, 08:04 PM
  2. A Headache of an Email Problem
    By AngelicKnight in forum General Computer Discussions
    Replies: 14
    Last Post: June 15th, 2006, 04:04 AM
  3. 500 mile email problem
    By Tedob1 in forum Tech Humor
    Replies: 0
    Last Post: December 23rd, 2002, 03:58 PM
  4. C problem...
    By Rna in forum General Programming Questions
    Replies: 4
    Last Post: May 22nd, 2002, 07:03 AM
  5. Help! I've got a nasty IDE problem
    By thesecretfire in forum Hardware
    Replies: 16
    Last Post: May 17th, 2002, 12:31 AM

Posting Permissions

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

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides