ClulessChris
IS-IT--Management
I’m using the following code (From to show and hide navigation menus.
Would it be possible (and if so how) to dynamically find the pixel height of the <a> tag the function is called from?
Html:
Never knock on Death's door: ring the bell and run away! Death really hates that!
Would it be possible (and if so how) to dynamically find the pixel height of the <a> tag the function is called from?
Html:
Code:
<a href="#" onMouseOver="hideAll(); showLayer('layer1'); stopTime()" onMouseOut="startTime();">menu 1</a><br><br>
<div id="layer1">
<a href="[URL unfurl="true"]www.somepage.com"[/URL] onMouseOver="stopTime();" onMouseOut="startTime();">Link 1</a><br><br>
<a href=" [URL unfurl="true"]www.somepage.com"[/URL] onMouseOver="stopTime();" onMouseOut="startTime();">Link 2</a><br><br>
<a href=" [URL unfurl="true"]www.somepage.com[/URL] onMouseOver="stopTime();" onMouseOut="startTime();">Link 3</a><br><br>
</div>
{/code]
Script:
[Code]
//Define global variables
var timerID = null;
var timerOn = false;
var timecount = 1000;
var what = null;
var newbrowser = true;
var check = false;
function init(){
// alert ("Running Init");
if (document.layers) {
// alert ("Running Netscape 4");
layerRef="document.layers";
styleSwitch="";
visibleVar="show";
screenSize = window.innerWidth;
what ="ns4";
}else if(document.all){
// alert ("Running IE");
layerRef="document.all";
styleSwitch=".style";
visibleVar="visible";
screenSize = document.body.clientWidth + 18;
what ="ie";
}else if(document.getElementById){
// alert ("Running Netscape 6");
layerRef="document.getElementByID";
styleSwitch=".style";
visibleVar="visible";
what="moz";
}else{
//alert("Older than 4.0 browser.");
what="none";
newbrowser = false;
}
//window.status='status bar text to go here';
check = true;
if(document.getElementsByTagName){
matchColumns();
}
}
// Turns the layers on and off
function showLayer(layerName){
if(check){
if (what =="none"){
return;
}
else if (what == "moz"){
document.getElementById(layerName).style.visibility="visible";
}
else{
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}
}
else {// alert ("Please wait for the page to finish loading.");
return;}
}
function hideLayer(layerName){
if(check){
if (what =="none"){
return;
}
else if (what == "moz"){
document.getElementById(layerName).style.visibility="hidden";
}
else{
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}
}
else {// alert ("Please wait for the page to finish loading.");
return;}
}
// function hideAll adapted by Chris Hellings to pick up all layers
function hideAll() {
var divNum = 1;
while (divEl = document.getElementById('layer' + divNum)) {
hideLayer(divEl.id);
divNum++;
}
}
function startTime() {
if (timerOn == false) {
timerID=setTimeout( "hideAll()" , timecount);
timerOn = true;
}
}
function stopTime() {
if (timerOn) {
clearTimeout(timerID);
timerID = null;
timerOn = false;
}
}
Never knock on Death's door: ring the bell and run away! Death really hates that!