T
that guy over there
Ugh, am pulling my hair out over this one...
I want to be able to format a page slightly differently depending on
whether or not a user is visiting the site using either Netscape 6 or
7.
That bit I seem to have sorted out; my problem is getting the &*$%#
link function to work from a document.write statement.
For example, the following code correctly differentiates between the
two Netscapes (at least on Windows):
<html>
<head>
<script>
// netscape browsers
var is_nn6 = (navigator.product == 'Gecko') &&
(!window.find)?true:false;
var is_nn7 = (navigator.product == 'Gecko') &&
(window.find)?true:false;
</script>
</head>
<body>
Netscape browsers<br>
<script>
document.write("NN6:" + is_nn6 + "<BR>");
document.write("NN7:" + is_nn7 + "<BR>");
</script>
</body>
</body>
</html>
But if I try adding the following code to the header of the page in
order to redirect the page to point to separate .css files, I only get
a page saying "Netscape browsers", so it is somehow blowing out the
valid true or false values I get from the ternary statements.
if (is_nn6)
{document.write("<link rel=\"stylesheet\"
href=\"nn6.css\"/>"};
else if (is_nn7)
{document.write("<link rel=\"stylesheet\"
href=\"nn7.css\"/>"};
What the heck am I doing wrong/am missing? Probably something silly
and obvious, but I can't figure out what... Ugh. Help much
appreciated.
I want to be able to format a page slightly differently depending on
whether or not a user is visiting the site using either Netscape 6 or
7.
That bit I seem to have sorted out; my problem is getting the &*$%#
link function to work from a document.write statement.
For example, the following code correctly differentiates between the
two Netscapes (at least on Windows):
<html>
<head>
<script>
// netscape browsers
var is_nn6 = (navigator.product == 'Gecko') &&
(!window.find)?true:false;
var is_nn7 = (navigator.product == 'Gecko') &&
(window.find)?true:false;
</script>
</head>
<body>
Netscape browsers<br>
<script>
document.write("NN6:" + is_nn6 + "<BR>");
document.write("NN7:" + is_nn7 + "<BR>");
</script>
</body>
</body>
</html>
But if I try adding the following code to the header of the page in
order to redirect the page to point to separate .css files, I only get
a page saying "Netscape browsers", so it is somehow blowing out the
valid true or false values I get from the ternary statements.
if (is_nn6)
{document.write("<link rel=\"stylesheet\"
href=\"nn6.css\"/>"};
else if (is_nn7)
{document.write("<link rel=\"stylesheet\"
href=\"nn7.css\"/>"};
What the heck am I doing wrong/am missing? Probably something silly
and obvious, but I can't figure out what... Ugh. Help much
appreciated.