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.prod uct == 'Gecko') &&
(!window.find)? true:false;
var is_nn7 = (navigator.prod uct == 'Gecko') &&
(window.find)?t rue: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=\"styleshee t\"
href=\"nn6.css\ "/>"};
else if (is_nn7)
{document.write ("<link rel=\"styleshee t\"
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. 2 1462
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.prod uct == 'Gecko') && (!window.find)? true:false; var is_nn7 = (navigator.prod uct == 'Gecko') && (window.find)?t rue: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=\"styleshee t\" href=\"nn6.css\ "/>"}; else if (is_nn7) {document.write ("<link rel=\"styleshee t\" 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/
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.prod uct == 'Gecko') && (!window.find)? true:false; var is_nn7 = (navigator.prod uct == 'Gecko') && (window.find)?t rue: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=\"styleshee t\" href=\"nn6.css\ "/>"}; else if (is_nn7) {document.write ("<link rel=\"styleshee t\" 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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 on the download link.
but I'm trying to do a redirect page, so that when the user clicks on
the link, a popup came on displaying a short text message, and after a
|
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 Request.Form value was detected
from the client (ResultInput="...="1.0"?> <ResultData
xmlns:xs...").
|
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 elements if the page is displayed in IE6 and
latest Mozilla? If displayed in Opera, the input box is as wide as the
other elements - as it should be.
|
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 publish it to the live server. This has been
working well for some time.
Now, all of a sudden, when I publish my site it no longer works on the live
server. It seemes as if it keeps redirecting to the same page over and over
|
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 Studio 2003 Version 7.1.3008
Framework 1.1 Version 1.1.4322 SP1
Windows XP Pro Version 2002 SP2
| |
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 & to be valid. I don't
have Firefox my self and don't wont to install it only because of this,
so I hope some of you gurus can enlighten me with this :)
In what circumstances can the "&" in the source code be involuntary
changed to "&" by a browser when or other software, when editing and
uploading the file to the web...
|
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. Each section has a list of questions. Each question has responses.
I need to display a list of responses to the questions (i.e. set:distinct), once and only once, each section.
My second problem is that these questions can also have corrective...
|
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: next_page.php");
However, as you know this causes information to be sent to the client
before the next page is contacted. Is there a way I can go to
|
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 resolve this issue once and for all now.
The problem might be PHP related but since I only develop applications using
PHP, I'm not a hundred percent sure. Therefor I've taken the liberty to
crosspost to comp.lang.php and alt.www.webmaster. I...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |