Change Background Color Using Prompt in Javascript

Change Background Color Using Prompt in Javascript.


CODE:
<!DOCTYPE html>

<html>
<head>
<title>Change Page Background onload</title>
<script type="text/javascript">
function changeBg(){
newCol = prompt("Which color you should use for Background color");
document.body.style.background=newCol;
}
</script>
</head>
<body>
<body onload="changeBg()">
</body>
</html>

Comments