Solved

how to change document background with mousedown event

Posted on 2009-05-14
5
204 Views
Last Modified: 2013-11-19
hi all,
my manager wants me to change the document background with mouse click
the sample does not work with me
could you please correct it for me

best regards
hatem gamal
<html>
    <head>
        <title>
            JavaScript Event Example
        </title>
    </head>
 
    <body id="n" name="n" bgcolor="#eeeeee" >
        <h1 onmousedown="var obj=document.getElementById("n");obj.bgcolor='#880000';">
            Click this page to turn it pink!
        </h1>
    </body>
</html>

Open in new window

0
Comment
Question by:hatem_from_mesr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 14

Accepted Solution

by:
sam2912 earned 500 total points
ID: 24383836

<h1 onmousedown="document.body.style.backgroundColor='#880000';">
   Click this page to turn it pink!
</h1>

Open in new window

0
 
LVL 14

Assisted Solution

by:sam2912
sam2912 earned 500 total points
ID: 24383855
#880000 will give you red. Try #DD9999 instead.
0
 

Author Closing Comment

by:hatem_from_mesr
ID: 31581390
thanks man
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24384240
this is how you can click on the page to change the color

<script>
window.onload=function() { document.onmousedown=function() { document.body.style.backgroundColor='pink' } }
</script>


0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24384247
ok, too late...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
make control visible based off other control value 7 44
Put POST values into cookies. 14 53
Check if field exists SPUtility 5 47
JSON help 8 46
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question