ClulessChris
IS-IT--Management
I'm new to Javascript so sorry in advance if this turns out to be a stupid mistake.
I'm calling the following functions from the rollover over event of a div.
I'm trying to have a hidden div display at the same height as the div it's called from, as part of my navigation menus.
This works fine in opera, but in IE7 I seem get an extra 100 pixels added and the div displays too low in the window.
can you please help?
Never knock on Death's door: ring the bell and run away! Death really hates that!
I'm calling the following functions from the rollover over event of a div.
I'm trying to have a hidden div display at the same height as the div it's called from, as part of my navigation menus.
This works fine in opera, but in IE7 I seem get an extra 100 pixels added and the div displays too low in the window.
can you please help?
Code:
function getElementTop(Elem) {
if(document.getElementById) {
var elem = document.getElementById(Elem);
} else if (document.all) {
var elem = document.all[Elem];
}
var yPos = elem.offsetTop;
tempEl = elem.offsetParent;
while (tempEl != null) {
yPos += tempEl.offsetTop;
tempEl = tempEl.offsetParent;
}
return yPos + 'px';
}
// Turns the layers on and off
function showLayer(layerName, matchElem){
var elemY = getElementTop(matchElem)
if(check){
if (what =="none"){
return;
}
else if (what == "moz"){
document.getElementById(layerName).style.visibility="visible";
alert("moz " + elemY)
document.getElementById(layerName).style.Top=elemY;
}
else{
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top="'+elemY+'"');
alert( elemY)
}
}
else {// alert ("Please wait for the page to finish loading.");
return;}
}
Never knock on Death's door: ring the bell and run away! Death really hates that!