473,324 Members | 2,254 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,324 software developers and data experts.

Firefox offsetLeft

This is a dropdown menu script thats works ok in IE but is not positioning
properly in Firefox. m.style.pixelLeft and Top are being set to the right
values. But the menu, in a div block, is being displayed as though the
pixelLeft and Top are being ignored.

<script type='text/javascript' >
var cm=null;
document.onclick = new Function("show(null)")
function getPos(el,sProp) {
var iPos = 0
while (el!=null) {
iPos+=el["offset" + sProp]
el = el.offsetParent
}
return iPos
}

function show(el,m) {
if (m) {
m.style.pixelLeft = getPos(el,"Left")
m.style.pixelTop = getPos(el,"Top") + el.offsetHeight
m.style.display='';
}
if ((m!=cm) && (cm)) cm.style.display='none'
cm=m
}
</script>
.. . .
<a href='page?page=gifts' class='menulink'
onmouseover='show(this,menu_gifts);' >
Gifts
</a>
.. . .

<!-- MENU BOX for gifts -->
<div id='menu_gifts' class='submenu' style='display: none;' >

<!-- start of imagebox -->
<table cellspacing='0' cellpadding='0' border='0'>
<tbody>
.. . .

Regards, Paul Nash
Jun 9 '06 #1
1 8709
Paul Nash wrote:
This is a dropdown menu script thats works ok in IE but is not positioning
properly in Firefox. m.style.pixelLeft and Top are being set to the right
values.
pixelLeft and pixelTop are IE specific properties. Of course you can add
these properties, but they don't have any meaning for Firefox.
function show(el,m) {
if (m) {
m.style.pixelLeft = getPos(el,"Left")
m.style.pixelTop = getPos(el,"Top") + el.offsetHeight


Try this:
m.style.left = getPos(el,"Left") + "px";
m.style.top = (getPos(el,"Top") + el.offsetHeight) + "px";

Robert.
Jun 9 '06 #2

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

Similar topics

4
by: Keith Thornhill | last post by:
I'm trying to calculate the top and left distance from the side of the browser of an object (either absolutely or relatively positioned) and i'm running into a weird problem as i'm trying to make...
2
by: Mark Szlazak | last post by:
The following code fails in Firefox to get at selected text in the right-side textarea. Any help would be appreciated. <html> <head> <script> var agt = navigator.userAgent.toLowerCase();...
1
by: Mickey | last post by:
Hi, I have a script which works in both IE but is sluggish in Firefox. The script is a simple text scroller. It works perfectly in IE however in Firefox, the text scroll slower and eventually...
3
by: jimmygoogle | last post by:
I posted earlier with a scope problem. I think I resolved it in IE but in Firefox it still exists. Anyone have any ideas/experience with this? I attached my code sorry it is so long. You can...
2
by: Gary Coutts | last post by:
Hi, I am developing a website using Visual Studio .Net 2003. When reading offsetLeft, in a javascript function, the result is fine when run under I.E. but gives wrong results when run under...
1
by: chris1606 | last post by:
This script floats one image over another (to conterract transparency). It works fine in Opera and Internet Explorer, but the image won't move in firefox. Any ideas how I can get it to work please? ...
1
by: inteli | last post by:
Hey anybody can help me out wid this code..Its working well in IE but nt in firefox.The problem lies in offset,clientX,clientY part but I dnt know how to resolve it .. var zxcDockAry=new Array();...
1
by: ehud37new | last post by:
this script work fine in IE but not in FireFox where is the problem? here is the script /*------------------------------------------------------------------ File: menu.js ...
1
by: xtremebass | last post by:
Hello Bytes, i have a calender program which is created by using Javascript. when i execute that program using Internet Explorer,it works properly but when i tried in Mozilla firefox it didnt...
1
by: sva0008 | last post by:
i have a auto suggest script that does not work in firefox , works great on IE. /******************************************************* AutoSuggest - a javascript automatic text input...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 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
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.