Script for selecting sheets

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 & Design,
University of Derby,
Britannia Mill,
Mackworth Road,
Derby.
DE22 3BL

R.Pearson@art.derby.ac.uk

www
Online Training: http://art.derby.ac.uk/direct/ (Work in Progress)
CyberForum:   http://art.derby.ac.uk/  (Previous Project)

Tel:01332 622222 x 4080
Fax:01332 622725

Received on Thursday, 24 September 1998 05:00:36 UTC