style switcher
Nancy Sosna Bohm
plum at ulink.net
Wed Jul 17 14:26:10 EDT 2002
I put together a javascript to switch styles on Mac & Win platforms in
Netscape and IE and NS pre-4.7 on Win. (We have a Mac server running
WebStar, and there are not too many ssi's.)
The test page that uses the script and styles is here:
http://www.lib.lfc.edu/testpages/no_at.html
The styles are
http://www.lib.lfc.edu/testpages/nsmac.css
http://www.lib.lfc.edu/testpages/iemac.css
http://www.lib.lfc.edu/testpages/nswin.css
http://www.lib.lfc.edu/testpages/iewin.css
http://www.lib.lfc.edu/testpages/ns47win.css
The script is here:
http://www.lib.lfc.edu/testpages/nesbstylesnoat.js
The only thing that's not "working" is that in NS on Mac the
header tags are tiny. Is it always necessary to declare header tags when
using a remote style sheets?
I would also greatly appreciate any warnings of impending doom should I
implement this by including the code in our header ssi that appears on all
pages.
Below is http://www.lib.lfc.edu/testpages/nesbstylesnoat.js
var ostype=navigator.platform.substring(0,3)
var browstype=navigator.appName
var browsver=parseInt(navigator.appVersion)
var browsverver=parseInt(navigator.appVersion.charAt(2))
var browsverns6=parseInt(navigator.appVersion.substring(0,1))
//mac ns aqua medium - mac ie yellow x-small - win ns red small - win ie
green small - win ns47 orange x-small
if (browstype=="Netscape"&&browsver>=4&&ostype=="Mac") {
document.write('<link rel="stylesheet" type="text/css" href="nsmac.css" />')
}
if (browstype=="Microsoft Internet Explorer"&&browsver>=4&&ostype=="Mac") {
document.write('<link rel="stylesheet" type="text/css" href="iemac.css"
/>');
}
if
(browstype=="Netscape"&&ostype=="Win"&&browsver>=4&&browsverver=="7"||browsv
er>=6) {
document.write('<link rel="stylesheet" type="text/css" href="nswin.css"
/>');
}
if (browstype=="Netscape"&&browsverver<="6"&&ostype=="Win") {
document.write('<link rel="stylesheet" type="text/css" href="ns47win.css"
/>');
}
if (browstype=="Microsoft Internet Explorer"&&browsver>=4&&ostype=="Win") {
document.write('<link rel="stylesheet" type="text/css" href="iewin.css"
/>');
}
End of js code
*********************************
Also for convenience, here's nsmac.css:
td {border-color:gray;
border-style:solid;
border-width:1px;font-family:arial, helvetica, verdana, sans-serif;
font-size:medium}
th {border-color:gray;
border-style:solid;
border-width:2px;font-family:arial, helvetica, verdana, sans-serif;
font-size:large;font-weight:400}
p,ul{font-family:arial, helvetica, verdana, sans-serif; font-size:medium}
li{font-family:arial, helvetica, verdana, sans-serif; font-size:medium}
a{color:00ffff}
body{font-family:arial, helvetica, verdana, sans-serif;font-size:medium}
Thanks.
Nancy
More information about the Web4lib
mailing list