Thingol
Technical User
- Jan 2, 2002
- 169
Hi all,
I have used this tutorial to create a set of stylesheets between which I can switch. I fact, I switch between two stylsheets that contain specific markup and I have one main sheet that is always enabled. The code works in IE, but not in Firefox.
Can anyone help me out? I really want it to work in Firefox as well.
Best regards,
Martijn Senden.
Here's the code I have:
In the Beginning there was nothing, which exploded.
--Terry Pratchett, Lords and Ladies--
I have used this tutorial to create a set of stylesheets between which I can switch. I fact, I switch between two stylsheets that contain specific markup and I have one main sheet that is always enabled. The code works in IE, but not in Firefox.
Can anyone help me out? I really want it to work in Firefox as well.
Best regards,
Martijn Senden.
Here's the code I have:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<title>Menu Sirena</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="Menu.css">
<link rel="stylesheet" type="text/css" href="menu800x600.css" title="menu800x600">
<link rel="stylesheet" type="text/css" href="menu1280x1024.css" title="menu1280x1024">
<script type="text/javascript" language="javascript">
if (screen.width > 1024) {
changeStyle('menu1280x1024');
}
if (screen.width < 1024) {
changeStyle('menu800x600');
}
if (screen.width == 1024) {
changeStyle();
}
function getAllSheets() {
if( !window.ScriptEngine && navigator.__ice_version ) { return document.styleSheets; }
if( document.getElementsByTagName ) { var Lt = document.getElementsByTagName('link'), St = document.getElementsByTagName('style');
} else if( document.styleSheets && document.all ) { var Lt = document.all.tags('LINK'), St = document.all.tags('STYLE');
} else { return []; } for( var x = 0, os = []; Lt[x]; x++ ) {
var rel = Lt[x].rel ? Lt[x].rel : Lt[x].getAttribute ? Lt[x].getAttribute('rel') : '';
if( typeof( rel ) == 'string' && rel.toLowerCase().indexOf('style') + 1 ) { os[os.length] = Lt[x]; }
} for( var x = 0; St[x]; x++ ) { os[os.length] = St[x]; } return os;
}
function changeStyle() {
for( var x = 0, ss = getAllSheets(); ss[x]; x++ ) {
if( ss[x].title ) { ss[x].disabled = true; }
for( var y = 0; y < arguments.length; y++ ) {
if( ss[x].title == arguments[y] ) { ss[x].disabled = false; }
} } }
</script>
</head>
<body>
</body>
</html>
In the Beginning there was nothing, which exploded.
--Terry Pratchett, Lords and Ladies--