C
cewisham
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?
Here is my javascript function for positioning the layers.
Below that is the URL of the page I am building.
/* START FUNCTION
*****************************************************/
function positionLayer(layerID, imageName) {
// positions layer 'layerID' at the same coordinates as image
'imageName'
var xPos, yPos, myElement, myLayer;
if(document.layers) { // NN4.x
xPos = document.images[imageName].x;
yPos = document.images[imageName].y;
} else if(document.all) { // IE4/IE5
xPos = getXPos(document.images[imageName]);
yPos = getYPos(document.images[imageName]);
myLayer = document.all[layerID];
} else { // ass-u-me W3 DOM
myElement = document.getElementById(imageName);
xPos = myElement.offsetLeft;
yPos = myElement.offsetTop;
myLayer = document.getElementById(layerID);
}
/* END FUNCTION *****************************************************/
http://www.qcbt.com/qcbtinternet/unsecure/index.aspx
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?
Here is my javascript function for positioning the layers.
Below that is the URL of the page I am building.
/* START FUNCTION
*****************************************************/
function positionLayer(layerID, imageName) {
// positions layer 'layerID' at the same coordinates as image
'imageName'
var xPos, yPos, myElement, myLayer;
if(document.layers) { // NN4.x
xPos = document.images[imageName].x;
yPos = document.images[imageName].y;
} else if(document.all) { // IE4/IE5
xPos = getXPos(document.images[imageName]);
yPos = getYPos(document.images[imageName]);
myLayer = document.all[layerID];
} else { // ass-u-me W3 DOM
myElement = document.getElementById(imageName);
xPos = myElement.offsetLeft;
yPos = myElement.offsetTop;
myLayer = document.getElementById(layerID);
}
/* END FUNCTION *****************************************************/
http://www.qcbt.com/qcbtinternet/unsecure/index.aspx