JavaScript program to change background color of a webpage provided by user

Write a function that prompts the user for a color and uses what they select to set the background color of webpage .



Source Code
<html>

<head>
    <title>Change background color on prompt</title>
    <script>
        function setBgColor() {
            var color = prompt("Enter the color", "white");
            document.body.style.backgroundColor = color;
            document.getElementById("panel").innerHTML = "Your given color: " + color;
        }
    </script>
</head>

<body onload="setBgColor()">
    <p id="panel"></p>
</body>

</html>
Output