Edit This Code:
<!DOCTYPE html>
<html>
<head>
<style>#myDIV {
    width: 300px;
    height: 300px;
    background-image: url("paper.gif");
}

</style>
</head>
<body>

<p>Click the "Try it" button to set the background-image property of the DIV element to "smiley.gif":</p>

<button onclick="myFunction()">Try it</button>

<div id="myDIV">
  <h1>Hello</h1>
</div>

<script>
function myFunction() {
     document.getElementById("myDIV").style.backgroundImage = "url(smiley.gif)";
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy