Javascript examples for CSS Style Property:position
Return the position of a <h2> element:
<!DOCTYPE html> <html> <body> <h2 id="myH2" style="position:absolute;left:100px;top:150px;">This is a heading</h2> <button type="button" onclick="myFunction()">Return type of position</button> <script> function myFunction() {//from w ww. j a va 2s. co m console.log(document.getElementById("myH2").style.position); } </script> </body> </html>