wrote on 07 jul 2006 in comp.lang.javascript
:
Evertjan. wrote:
>wrote on 07 jul 2006 in comp.lang.javascript:
When I click on a link it shows a div above all other elements of my
page (a kind of popup). I would like to close it(hide the div again)
when the user clicks anywhere on the screen. How can i do that? The
'event listener' should only be activated if the div is visible.
<body onclick='if(thatDivDisplayBlock)thatDivDisplayNone ()'>
[please skip the signature in replies,
or have a decent newsreader do that automagically]
>--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[please do not toppost on usenet, corrected]
I can't access the body from my page as it is in a master page (i'm
doing asp.net). However I have a javascript function bodyLoad() which
is called at body load and in which I can do stuff. How can I assigne
the onclick event in this function ?
I would have no idea about "bodyLoad()": if this is asp.net, better ask
an asp.net group.
What is a master-page? Are you using iframes? Or is the <bodyset in a
include?
what about
:
body.onload = myfunc; // Use no () !
function myfunc() {
if (thatDiv.display != 'none') // this line could be skipped ;-)
thatDiv.display = 'none';
};
not tested
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)