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
You misunderstand the meaning of elements "style" property. By referring element.style what you actually retrieving is elements inline style. For example:
var el = document.getElementById('myEl');
console.log(el.style.zIndex); //you are asking for
and to get the value of your css style(it could be a code goes here tag or any external stylesheet) you have to check is standard method (window.getComputedStyle) supported or not, if not you should check for internet explorer's specific version. You could do so by referring to el.currentStyle.
Summary:
to get inline style: var zIndex = el.style.zIndex
to get stylesheet value or style tag value:
standard method: var zIndex = window.getComputedStyle(el,null).getPropertyValue('z-index');
ie method: var zIndex = el.currentStyle['z-index'];