[Javascript] hide other divs

Michael Borchers list at tridemail.de
Wed Apr 12 02:19:53 CDT 2006


the following function works fine in IE, not in FF.
I guess i worked a little bit dirty and FF is missing some kind of ID.

example div:
<div name="ordersDiv" id="ordersDiv" style="display:block">

function:
function hideOtherDivs(myDiv, mySubstring)
{
 var divElements = document.getElementsByTagName("div");

    for(i=0;i<divElements.length;i++)
 {
        divElementsId = divElements[i].getAttribute("id");
  
  if(divElementsId.substring(0,6) == mySubstring && divElementsId != myDiv)
  {
   divElements[i].style.display = "none";    
        }
    }
}

call:
javascript:hideOtherDivs('ordersDiv', 'orders');
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060412/53d9042e/attachment.htm>


More information about the Javascript mailing list