If I use setCapture() on an object, any mouse event that subsequently occurs applies to that object.

Therefore, in the following test code, I have set setCapture() on the menus object at load time.

Therefore, when I click on the document anywhere outside of the menus object, it should disappear.

Why is it not doing this?... Here is my test code, thanks,



function init()

function click_me()
     menus.innerHTML = ""


<DIV id="menus" onclick="click_me()" style="background-color:green; top:30; left:30"><span>Teddy</span></DIV>

</BODY onload="init()">

Who is Participating?
knightEknightConnect With a Mentor Commented:
Can you set the onLoad handler in the /body tag?

try this:

   <BODY onload="init()">

instead of this:

   </BODY onload="init()">
sortyAuthor Commented:
eureka! thanks,
I was staring at it for ages.. just needed the third eye.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.