473,396 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problems Redirecting to a CSS Page Once NN6 & NN7 are Detected

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.

Jul 20 '05 #1
2 1454


that guy over there wrote:
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.


Check the JavaScript console, if the code throws an error it will be
reported there

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
On Mon, 11 Aug 2003 15:41:26 +0200, Martin Honnen
<Ma***********@t-online.de> wrote:


that guy over there wrote:
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.


Check the JavaScript console, if the code throws an error it will be
reported there


Doh! Was missing a ")" at the end of each line of the document.write
statement. And Venkman lead me right to it, like you suggested. ;-)

Ugh.
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Movie Maniac? | last post by:
Hi everybody I'm writing a module for postnuke and MD-Pro to manage a subtitles section, and I'm experiencing some troubles with the download function. It works properly if I click directly...
1
by: mar | last post by:
Does anybody know what configuration section should i set to false here. I also tried setting the page directive to false but that didn't fix it. Thanks! mc A potentially dangerous...
14
by: Peter Pfannenschmid | last post by:
Dear all, my question is concerning the following html page: http://www.omeganet.de/test/test.shtml Could anybody tell me why the text input box (the fourth element) is wider than the other...
0
by: Sune Hansen | last post by:
Hi guys, I really hope someone can help me with my problem. Here is the scenario: I have a development environment on my locale machine. Once in a while when everything has been tested I...
2
by: Gary Coutts | last post by:
Hi, I am have problems redirecting from a login page. The login page is simple, with just 2 textboxes and one button. On the button click the routine below is called: I am using: Visual...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
0
by: DAnne | last post by:
Hi, I'm very new to xslt and this is my first time posting to a Forum so please forgive me if I transgress any protocols. I have to do a tally report. This report is divided up into sections....
7
by: laredotornado | last post by:
Hello, I'm using PHP 4.4.4. After processing some data, I'd like to redirect to another page for further data processing. The way I'm redirecting right now is header("Location:...
41
by: amygdala | last post by:
Hello all, I have posted a similar question in comp.lang.php in the past, but haven't had any response to it then. I kinda swept the problem under the rug since then. But I would really like to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.