-
June 27th, 2007, 02:37 PM
#1
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.
-
June 27th, 2007, 03:44 PM
#2
-
June 28th, 2007, 09:54 AM
#3
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.
-
June 28th, 2007, 02:59 PM
#4
-
June 28th, 2007, 04:05 PM
#5
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
-
By The Texan in forum Operating Systems
Replies: 16
Last Post: June 22nd, 2006, 08:04 PM
-
By AngelicKnight in forum General Computer Discussions
Replies: 14
Last Post: June 15th, 2006, 04:04 AM
-
By Tedob1 in forum Tech Humor
Replies: 0
Last Post: December 23rd, 2002, 04:58 PM
-
By Rna in forum General Programming Questions
Replies: 4
Last Post: May 22nd, 2002, 07:03 AM
-
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
-
Forum Rules
|
|