Find Highest Z-Index Position





5
Date Submitted Fri. Aug. 25th, 2006 4:16 AM
Revision 1 of 1
Helper Cyber-Drugs
Tags return
Comments 1 comments
Ever wanted to determine what is the highest Z-Index out of everything displayed on your page, so that you can move an object to a higher position? Well the code below will do exactly that, it's not my own code, I've been using it for quite a few months now, so unfortunately I cannot remember where I got it from.

function docjslib_findHighestZ() {
     var documentDivs = new Array();
     documentDivs = document.all.tags("DIV");
     var highestZ = 0;
     for (var i = 0; i < documentDivs.length; i++) {
          var Zindex = documentDivs[i].style.zIndex;
          if (Zindex > highestZ) {
               highestZ = Zindex;
          }
     }
     return highestZ;
}
 

Justin Nel

Comments

Comments Nice code
Sat. Aug. 26th, 2006 8:36 AM    Helper psykoprogrammer

Voting