Javascript examples for CSS Style Property:zIndex
Return the z-index property value of an <img> element:
<!DOCTYPE html> <html> <body> <h1>This is a Heading</h1> <img id="img1" src="http://java2s.com/resources/c.png" style="position:absolute;left:0px;top:0px;z-index:-1;width:100px;height:180px;"> <button type="button" onclick="myFunction()">Alert stack order</button> <script> function myFunction() {//w w w. jav a2 s. c om console.log(document.getElementById("img1").style.zIndex); } </script> </body> </html>