473,322 Members | 1,526 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,322 software developers and data experts.

Problem with getting the doc

Hello,

I use the following javascript code, which works well in IE and Opera,
but doesn't work with Firefox and Mozilla.

I always get an error "doc is not defined" when try to run code
eval(doc + layerName + sty + ".left = " + (eval(FromLeft) + 15))

Before I setup the doc variable as this:
var ie = document.all ? 1 : 0
var ns = document.layers ? 1 : 0
if(ns){doc = "document."; sty = ""}
if(ie){doc = "document.all."; sty = ".style"}

Any idea?

Thanks!
Jul 23 '05 #1
2 1046
Clemenza wrote:
Hello,

I use the following javascript code, which works well in IE and Opera,
but doesn't work with Firefox and Mozilla.
It doesn't "work well" in IE or Opera, you just think it does.
I always get an error "doc is not defined" when try to run code
eval(doc + layerName + sty + ".left = " + (eval(FromLeft) + 15))
Why are you using eval when you don't need it?
Had you bothered reading the group FAQ before posting you would have,
undoubtedly, found this section:

http://jibbering.com/faq/#FAQ4_40

Before I setup the doc variable as this:
var ie = document.all ? 1 : 0
var ns = document.layers ? 1 : 0
if(ns){doc = "document."; sty = ""}
if(ie){doc = "document.all."; sty = ".style"}
Geeeez....
Ummm, you should read that FAQ, especially section:

http://jibbering.com/faq/#FAQ4_26
Any idea?
Trash your code, buy a book, and start over.
Thanks!


Welcome.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2
Clemenza wrote:
I use the following javascript code, which works well in IE and Opera,
but doesn't work with Firefox and Mozilla. var ie = document.all ? 1 : 0
Internet Explorer stuff that Opera and Mozilla support - but Mozilla only
very recently introduced support and returns false to document.all to
discourage its use. You only need this if you need to support versions of
IE older then 6.
var ns = document.layers ? 1 : 0


Netscape 4 specific code. Support dropped after the 4.x series.

See http://www.mozilla.org/docs/web-deve...upgrade_2.html

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #3

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

Similar topics

6
by: Shaun Fleming | last post by:
I've been trying to make this simple script compatible across various browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I have version 7.11). This is what is supposed to happen:...
11
by: Abhishek | last post by:
I have a problem transfering files using sockets from pocket pc(.net compact c#) to desktop(not using .net just mfc and sockets 2 API). The socket communication is not a issue and I am able to...
8
by: I am Sam | last post by:
Hi everyone, This problem is making me old. I don't want to get any older. I have a multi-nested repeater control as follows: <asp:Repeater ID="clubRep1" Runat="server">...
12
by: Brad Baker | last post by:
I am trying to write a simple ASP.net/C# page which allows users to select some values and produce a report based on a SQL query. I have a self posting dropdown form which allows users to select...
5
by: H J van Rooyen | last post by:
Hi, I am struggling to get the pack method to do what I intend. I am trying to display user input in a seperate window, along with a little description of the field, something like this: ...
12
by: Light | last post by:
Hi all, I posted this question in the sqlserver.newusers group but I am not getting any response there so I am going to try it on the fine folks here:). I inherited some legacy ASP codes in my...
0
by: hardikpatelmca | last post by:
Hi All, I am working on web application which communicate with Communicator Web Access and Live communication Server. I can successfully logged into LCS system using my web application. And also...
2
by: Dark Wind | last post by:
Hi, I have been using OPT++ to solve a non linear programming problem. I am totally new to C++, but I looked at an example given on OPT++ website and modified it according to my problem. But I...
9
by: =?Utf-8?B?dHBhcmtzNjk=?= | last post by:
OK I have some Chinese text in sql server column that looks like this: 12大专题调研破解广东科学发展难题 This is unicode? Anyway, I put this data into a text area like this:...
4
by: imaloner | last post by:
I am posting two threads because I have two different problems, but both have the same background information. Common Background Information: I am trying to rebuild code for a working,...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.