Re: Position layers works in IE not Firefox/Safari
- From: Gérard Talbot <newsblahgroup@xxxxxxxxxxx>
- Date: Wed, 26 Apr 2006 14:02:19 -0400
cewisham@xxxxxxxxx wrote :
I have a menu that pops up different layers as you mouse over. Seems to
work OK in IE 6. I position the layers dynamically with javascript
because the menu moves when users resize their browser window. In the
Firefox or Safari browsers the position of the layers is 0,0 no matter
what, right off the bat. Top left corner.
Can any one tell me why?
The Magpie got it: you are passing the image name when you should be passing the id attribute if you use getElementById or the image name with document.images collection. You can't mix the 2.
What Randy told you is also correct and good. The first branch of a if..else..else block should be the W3C DOM support.
function positionLayer(layerID, imageName)
{
var xPos, yPos, myElement, myLayer;
if(document.images)
// DOM 2 HTML compliant
// http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-90379117
{
xpos = getXPos(document.images[imageName]);
yPos = getYPos(document.images[imageName]);
};
}
I suggest you drop the document.layers block unless you can test the function+DHTML menu with NS 4.x and if you know that there are still users using it... and even there, I'd never recommend using NS 4.x to reach a bank website. NS 4.x users represent less than 0.5% worldwide: it's definitely not worth the huge trouble coding for NS 4.x involves.
I'm going to add that your webpage is full of deprecated markup code, uses transitional DTD and is full of nested tables: there is no reason for all this.
Table-based webpage design versus CSS-based webpage design: resources
http://www.gtalbot.org/NvuSection/NvuWebDesignTips/TableVsCSSDesign.html
HTML Tidy extension for Firefox users
http://users.skynet.be/mgueury/mozilla/index.html
Why we won't help you
http://diveintomark.org/archives/2003/05/05/why_we_wont_help_you
HTML markup validator
http://validator.w3.org/
Gérard
--
remove blah to email me
.
- Follow-Ups:
- Re: Position layers works in IE not Firefox/Safari
- From: Matt Kruse
- Re: Position layers works in IE not Firefox/Safari
- References:
- Position layers works in IE not Firefox/Safari
- From: cewisham@xxxxxxxxx
- Position layers works in IE not Firefox/Safari
- Prev by Date: Re: Timeline API
- Next by Date: Re: New guy to javascript needs help!
- Previous by thread: Re: Position layers works in IE not Firefox/Safari
- Next by thread: Re: Position layers works in IE not Firefox/Safari
- Index(es):
Relevant Pages
|