<html>
<body>
<button type="button" onclick="myFunction()">Get background position</button>
<br>
<div id="myDiv" style="background: url('img_tree.png') no-repeat center;height:500px;width:500px;border:1px solid black;">
</div>
<script>
function myFunction() {
alert(document.getElementById("myDiv").style.backgroundPosition);
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_style_backgroundposition4 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:03:07 GMT -->
</html>