[Cascading Style Sheets]
[Previous page] [Next page] [Section contents page]

Scripting the Style Sheet Links

In addition to overlays, you will also need to script the links to separate style sheets. An expanded and modified version of the scripts to do the overlays will work:

	<script language="JavaScript">
	// this script determines whether the user's browser
	// is IE3, IE4, or Netscape 4, and loads a different
	// style sheet for each; for other browsers,
	// it does nothing
	<!--
	 var browser=navigator.appName;
	 var version=navigator.appVersion
	 var ver1=version.substring(0,1)
	 var ver2=version.lastIndexOf("MSIE")
	 var ver3=version.substring(ver2+5,ver2+6)
	
	 function itsNetscape() {
	  document.write('<LINK REL=StyleSheet HREF="styles/nn4.css" TYPE="text/css">')
	 }	
	 function itsMsie() {
	  if (browser == "Microsoft Internet Explorer")
	  ieVersion()
	 }
	 function ieVersion(){
	  if (ver1 >= 4)
	   document.write('<LINK REL=StyleSheet HREF="styles/ie4.css" TYPE="text/css">')
	  if (ver3 == 3)
	   document.write('<LINK REL=StyleSheet HREF="styles/ie33.css" TYPE="text/css">')
	 }
	 if ((browser == "Netscape") && (ver1 >= 4)){
	  itsNetscape()
	 }
	 else{
	  itsMsie()
	 }
	// -->
	</script>

	
(many thanks to Bernhard Friedrich for helping to work out some details of this script)

Note: you will need to replace the italicized portions of the script with the appropriate path and file name for your style sheets.

[Previous page] [Next page] [Section contents page]