<!DOCTYPE html>
<html>
<body>

<h1>Hello World!</h1>

<div id="myDiv" style="background-color:orange;">This is a div element.</div>
<br>
<button type="button" onclick="myFunction()">Get the background color of div</button>

<script>
function myFunction() {
    alert(document.getElementById("myDiv").style.backgroundColor);
}
</script>

</body>
</html>