Krudo
02-03-2005, 10:41 AM
Hi all
I am a n00b to this site and JavaScript and thought this would work but for some reason I think it needs a source within the <body></body> otherwise there is nothing to tell the script to work or am I completely barking up the wrong tree...
What I'm after is Microsoft and Netscape, Mozilla, Firefox and so on to detect the browser the user is using when viewing the site, therefore showing the correct CSS file for the correct browser. Neat yeah...? But when I view the page none of the CSS will work...
Any aides please... :confused:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Under Development - Coming Soon</title>
<script type="text/javascript" language="javascript">
<!--
if (navigator.appName == 'Microsoft
Internet Explorer') {
document.write('<link rel="stylesheet" type="text/css" href="images/blue/style.css">')
}
else {
document.write('You are running either Mozilla, Firefox or Netscape?')
}
}
// -->
</script>
</head>
<body background="images/blue/background.gif">
</body>
</html>
I am a n00b to this site and JavaScript and thought this would work but for some reason I think it needs a source within the <body></body> otherwise there is nothing to tell the script to work or am I completely barking up the wrong tree...
What I'm after is Microsoft and Netscape, Mozilla, Firefox and so on to detect the browser the user is using when viewing the site, therefore showing the correct CSS file for the correct browser. Neat yeah...? But when I view the page none of the CSS will work...
Any aides please... :confused:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Under Development - Coming Soon</title>
<script type="text/javascript" language="javascript">
<!--
if (navigator.appName == 'Microsoft
Internet Explorer') {
document.write('<link rel="stylesheet" type="text/css" href="images/blue/style.css">')
}
else {
document.write('You are running either Mozilla, Firefox or Netscape?')
}
}
// -->
</script>
</head>
<body background="images/blue/background.gif">
</body>
</html>