Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close on mousedown anywhere on page

Status
Not open for further replies.

jdbolt

Programmer
Aug 10, 2005
89
CA
Hi,

Is it possible to hide a div when the mouse is clicked anywhere on the page.

Basically I have a div popup that hovers by a form field when it has not been filled out, so when the user clicks anywhere else on the page, the div will disappear.

Thanks!
 
in it's simplest form:

Code:
<html>
<head>
<script type="text/javascript">
onmousedown=function(){document.getElementById('d1').style.display='none';};
</script>
</head>
<body>
  <div id="d1">stuff stuff stuff</div>
</body>
</html>

*cLFlaVA
----------------------------
[tt]I already made like infinity of those at scout camp...[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top