So normally we can get z-Index value of a div element using, e.g:
var zindex = document.getElementById(\'id\').style.zIndex;
I am using this
Have a look at this question: Getting the z-index of a DIV in JavaScript?:
Since z index is mentioned in the CSS part you won't be able to get it directly through the code that you have mentioned. You can use the following example.
function getStyle(el,styleProp)
{
var x = document.getElementById(el);
if (window.getComputedStyle)
{
var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
}
else if (x.currentStyle)
{
var y = x.currentStyle[styleProp];
}
return y;
}
pass your element id and style attribute to get to the function.
Eg:
var zInd = getStyle ( "normaldiv1" , "zIndex" );
alert ( zInd );
For firefox you have to pass z-index instead of zIndex
var zInd = getStyle ( "normaldiv1" , "z-index" );
alert ( zInd );
Reference
You must use z-index
for Chrome as well.