[Javascript] IE & NN dom references

Peter-Paul Koch gassinaumasis at hotmail.com
Thu Mar 22 05:15:22 CST 2001



>I want store references to DIV and IMG elements in a common array so that I
>don't have to worry if it came from NN4.x or IE. If I have a DIV like this:
>
><div id="OObj2" STYLE="...stuff...">
><img id="GGeo2" SRC="Geo2.png" alt="something" width=643 height=165>
></div>

if (document.getElementById) // NN6, IE5, Opera 5
{
   ob[1].style = document.getElementById('OObj2').style;
   ob[1].geom = document.getElementById('GGeo2');
}
else if (document.all) // IE4
{
   ob[1].style = document.all['OObj2'].style;
   ob[1].geom = document.all['GGeo2'];
}
else if (document.layers) // NN4
{
  ob[1].style = document.layers['OObj2'];
  ob[1].geom = document.layers['OObj2'].document.images['GGeo2'];
}

ppk

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.





More information about the Javascript mailing list