473,796 Members | 2,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

css layer not working in Firefox or Netscape

Hi Javascript gurus:

I have tried several things, using several Javascript books, but can't get
this to work in Netscape (latest version) and Firefox (latest v.). It works
in MIE and Opera fine. A box (defined by a css layer) is supposed to pop
out to the right when the corresponding box on the far left is moused over.
The first function defines a layer id to the next function which pops out
the box. After debugging in Venkman, it looks like the first function
cannot define the layer id properly to the second function, which actually
slides the box (layer) to the right.

I thought that the getElementById function was supposed to work for Firefox,
but I must be using it wrong(???)

To see how it's supposed to work, view the following page in MIE or Opera:
http://www.tfn.net/~chorale/join_us.html

function makeName(layerI D) {

if (document.all)
{ refname = eval("document. all." + layerID + ".style") }
else if (document.layer s)
{ refname = eval("document. layers(layerID) "); }
else
{ refname = document.getEle mentById("layer ID"); }
// { refname = layerID }
// { refname = eval("document. " + layerID) }
// { refname = eval("document. " + layerID) }
// { refname = layerID; }
return refname;
}

function slide () {
if ((parseInt(laye rname.left) < xgoal) ||
(parseInt(layer name.top) < ygoal))
{ layername.left = parseInt(layern ame.left) + xhop;
layername.top = parseInt(layern ame.top) + yhop;
// window.setTimeo ut("slide()", delay)
}
else if ((parseInt(laye rname.left) == xgoal) ||
(parseInt(layer name.top) == ygoal))
{ layername.left = parseInt(layern ame.left) - xhop;
layername.top = parseInt(layern ame.top) - yhop;
// window.setTimeo ut("slide()", delay)
}
}

This is a portion of the HTML code that calls the box (in this case, the
"sponsors" css class), and assigns it a layer name, which is then passed to
the slide function, which moves the box to the right based on the x & y
coordinates. The box is defined by a css <div class=> statement as
'sponsors'.:

layername=makeN ame('sponsors') ; yhop=0; ygoal=150; xhop=165; xgoal=165;
slide()";

Thanks for any help you can give.
--
Rebecca Levings
Lively Health Products
850-443-4641
rl**********@co mcast.net
http://www.lively.myarbonne.com
https://www.juiceplus.com/athlete/+rl21248
Nov 26 '05 #1
4 1833


You are leaving out .style as part of the object assignment in the
..layers and .getElementById lines for "refname":

if (document.all)
{ refname = eval("document. all." + layerID + ".style") }
else if (document.layer s)
here ^
{ refname = eval("document. layers(layerID) "); }
here^
else
{ refname = document.getEle mentById("layer ID"); }
and here^

chances are IE is using the .all part, since is in met in the IF and
skipping the rest, thus it works, Opera does .all object too, so,
Geckos do .all too but limited.
Danny
Nov 26 '05 #2
jsreblev wrote:
if (document.all)
Needed exclusively for Internet Explorer 4. Other versions of Internet
Explorer support it. Some other browsers support it, but, AFAIK they all
return false if you test for it (on the principle that if you are smart
enough to test for it, your smart enough to use the standard DOM).
else if (document.layer s)
Needed for, and supported only by, Netscape 4.x.
{ layername.left = parseInt(layern ame.left) + xhop;


http://www.mozilla.org/docs/web-deve...ade_2.html#dom

Not going near the style property of the element, and failing to set units
(which are required for non-zero lengths).

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Nov 26 '05 #3
jsreblev wrote:
[...]
function makeName(layerI D) {

if (document.all)
{ refname = eval("document. all." + layerID + ".style") }


What Daivd said, plus the use of eval here is totally redundant:

refname = document.all.la yerID.style;

There is also no need to make refname global (it's not needed at all).
Test getElementById first, it will suit 99% of browsers:

if (document.getEl ementById) {
return document.getEle mentById(layerI D).style;
} else if (document.all)
return document.all[layerID].style;
} else if (document.layer s){
return document.layers (layerID);
}
return null;
Untested, based on your code.

[...]

--
Rob
Nov 26 '05 #4
On 2005-11-25, jsreblev <js*******@comc ast.net> wrote:
Hi Javascript gurus:

I have tried several things, using several Javascript books, but can't get
this to work in Netscape (latest version) and Firefox (latest v.). It works
in MIE and Opera fine. A box (defined by a css layer) is supposed to pop
out to the right when the corresponding box on the far left is moused over.
The first function defines a layer id to the next function which pops out
the box. After debugging in Venkman, it looks like the first function
cannot define the layer id properly to the second function, which actually
slides the box (layer) to the right.

I thought that the getElementById function was supposed to work for Firefox,
but I must be using it wrong(???)

To see how it's supposed to work, view the following page in MIE or Opera:
http://www.tfn.net/~chorale/join_us.html

function makeName(layerI D) {

if (document.all)
{ refname = eval("document. all." + layerID + ".style") }
else if (document.layer s)
{ refname = eval("document. layers(layerID) "); }


is document.layers a function or a object?

also I don't see the element you are trying to access, does it have the id
property?

--

Bye.
Jasen
Nov 27 '05 #5

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

Similar topics

6
5030
by: Geoff | last post by:
When trying to focus a field in Firefox, I get the following error: Error: " nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: file:///C:/Documents%20and%20Settings/Edd/Desktop/test.html :: valText :: line 24" data: no] Source File: file:///C:/Documents%20and%20Settings/Edd/Desktop/test.html Line: 24 Anyone have any ideas as to why this is happening?
2
1471
by: Peregrine Maitland | last post by:
I have scrolling news that is based on JavaScript on the site I maintain. The script works in Internet Explorer 6.x, but not Firefox 1.0. It's not clear to me why the script doesn't work with Firefox. I'd appreciate it if someone could help me modify the script so that it would also work with Firefox. The scrolling news can be seen on the page at: http://www.shtetlinks.jewishgen.org/WielkieOczy/
6
1996
by: christian9997 | last post by:
Hi I would be very helpful if someone could help me with this code. It works fine in IE but when I display it in Netscape or Firefox and I move the mouse from one menu to the other the gap between the two menus gets bigger. What is the cause of this? Thanks CODE:
87
9632
by: expertware | last post by:
Dear friends, My name is Pamela, I know little about CSS, but I would like to ask a question I have an image on a web page within a css layer: <DIV ID=MyLayer STYLE = "position: absolute;top:68px; left:563px; width:640px;height:480px;"> <IMG src="ReportImageBox_12.54.52.png" width=640 height=480></IMG>
1
2600
by: Jordan | last post by:
I set the cursor property to change to the "hand" when the user performs an "onmouseover" event on a hyperlink object. This does work correctly with Internet Explorer, however, with Netscape and Firefox, the cursor is just the "vertical line." Does anyone know why this isn't working with Netscape or Firefox? Thanks!
6
14465
by: Mark Olbert | last post by:
The doPostBack javascript functioning is not submitting the page when called by linkbuttons (or an autopostback checkbox, for that matter). I'm aware of a problem with Netscape browsers and the postback code, but I have a workaround for that installed (and it looks like the code generated by ASP.NET when it renders the page does the same thing, namely, setting document<). However, the problem still exists under firefox. Has anyone come...
49
3988
by: Atul Chaturvedi | last post by:
If we use ASP.NET 2.0 Login Control, we are unable to click on Login and Reset Buttons on Safari running on Apple Mac OS X Version 10.3.2 . How can i resolve the problem.
16
14767
by: Dobedani | last post by:
Dear All, I found the code added below at: http://simplythebest.net/sounds/sound_guide.html Unfortunately, the code doesn't seem to work in Firefox. These are the error messages I can see in my Javascript Console: Error: self.document.guitar.IsReady is not a function Error: self.document.guitar.stop is not a function
7
1615
by: Joe | last post by:
I've been playing around with atlas for hte past couple days and its very impressive. However the standard browser here is Netscape, specifically: Netscape 7.02 Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02 While everythign works great in Firefox and IE, absolutely nothing seems to work with netscape. Is there something I need to change in my browser caps to get it to work in netscape? I want to...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9531
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,...
0
10237
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 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...
0
10018
tracyyun
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...
0
9055
agi2029
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...
0
6795
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();...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4120
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
3
2928
bsmnconsultancy
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...

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.