When i'm click on the web page, the page turn off to balck color. is it possible?
Help me..........

<body onMouseover="document.bgcolor='black'">

It was working fine for me.

commented: You solved my problem. Thanks., +0

Thank you. It was also working fine to me.

If you are creating a page and want to change the background on click you might just assign a click event to the window that would toggle the background color of the page.For example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

<style type=text/css>
<!--<script src="../lib/jquery-1.3.2.js" type="text/javascript"></script>-->
<script type="text/javascript">
 function init(){
	document.body.onclick = function(){
	function colorChange(){
		var colors = ["red","green","blue","orange","pink"];
		var index = Math.floor(Math.random() * 100) % 5;
		document.body.style.background = colors[index];
window.onload = init;
<p>Click the page to change colors</p>

In IE it is important to set the height and width of the body and html to 100% or IE thinks the body is just around the content and not the size of the screen. In FF it doesn't matter.

Ur code was ok. But the poster was asking not to create a page. Just apply color when click on the page. As per his post, i suggest this code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.