Women in Technology

Hear us Roar



Article:
  Cross-Browser Layers: Part 2
Subject:   Huh?
Date:   2001-08-16 15:19:30
From:   johnq
Why would you use:
onMouseOver='hide();


...with:


function hide() {
if (W3C) {
document.getElementById('layer1').style.visibility = "hidden";
document.getElementById('layer2').style.visibility = "hidden";
document.getElementById('layer3').style.visibility = "hidden";
document.getElementById('layer4').style.visibility = "hidden";
}
else if (IE4) {
document.all['layer1'].style.visibility = "hidden";
document.all['layer2'].style.visibility = "hidden";
document.all['layer3'].style.visibility = "hidden";
document.all['layer4'].style.visibility = "hidden";
}
else if(NN4) {
document.layers['layer1'].visibility = "hidden";
document.layers['layer2'].visibility = "hidden";
document.layers['layer3'].visibility = "hidden";
document.layers['layer4'].visibility = "hidden";
}
}



...ad nauseum when you could just do:



function hide(layerName) {
if (W3C) {
document.getElementById(layerName).style.visibility = "hidden";
}
else if (IE4) {
document.all[layerName].style.visibility = "hidden";
}
else if(NN4) {
document.layers[layerName].visibility = "hidden";
}
}


...and call it with:
onMouseOver='hide("layer1");


...etc.......???


That's what functions are for. :)

Full Threads Oldest First

Showing messages 1 through 2 of 2.

  • Huh?
    2001-08-16 16:02:10  johnq [View]

    Nevermind, I was thinking "tooltips" not menu! :)
    • STYLE / POSITION
      2005-07-25 00:49:55  Dr_Fre [View]

      I tried dusing the menu on a HP linux with NS4
      because of the following tag no style is applied:
      style='position: absolute;'
      but still it is needed to position the div/menu
      i tried the following but the menu can not be shown .

      if(ns4){
      document.write('<div id=\'menudiv\' >');
      }
      else{
      document.write('<div id=\'menudiv\' style=\'position: absolute;\'>');
      }

      someone also encountered this problem
      or was even able to solve it???