How to set a HTML document's background color in JavaScript?

How to set a HTML document's background color in JavaScript?

Using document object the back ground color can be changed by JavaScript.

The following example illustrates it.
<html>
<body>
<script type="text/javascript">
document.body.bgColor="green";
</script>
</body>
</html>

How to set a HTML document's background color in JavaScript?

<script>
var color = '#F4F4F4';
function colorbackground(code)
{
   document.bgColor = backColor[code];
}
</script>
How do you assign object properties?
Java script object properties are assigned like assigning a value to a variable...
What is JavaScript?
JavaScript is a scripting language most often used for client-side web development...
What boolean operators does JavaScript support?
What boolean operators does JavaScript support? Java script supports...
Post your comment