Selecting Stylesheets

Hi,

Can anyone help on this one? I'm using the following JavaScript to select
between two stylesheets- 1 for Navigator and 1 for Explorer:

<script language="JavaScript">
<!--
// this script determines whether the user's browser
// is  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="../../stylesheets/n4direct.css"
TYPE="text/css">') } 
function itsMsie() {
  if (browser == "Microsoft Internet Explorer")
    ieVersion()
     } 
     function ieVersion(){
      if (ver1 >= 4)
         document.write('<LINK REL=StyleSheet
HREF="../../stylesheets/direct.css" TYPE="text/css">') 
} 
 if ((browser == "Netscape") && (ver1 >= 4)){  itsNetscape() } else{ 
itsMsie() }
// --></script>


This is creating problems...
On a Mac using IE4 it's fine, but if you try and re-size the browser using
Netscape it crashes the machine. Furthermore, using refresh on IE4 on NT
causes the layout to go haywire (I've yet to test Netscape on a  PC).

Has anyone any solutions/alternatives please?

Russell Pearson
Media Delivery Specialist
School of Art and Design
University of Derby.

e-mail: R.Pearson@art.derby.ac.uk
Tel 01332 622222 ext 4080

Received on Wednesday, 23 September 1998 11:22:31 UTC