Solved

setCapture()

Posted on 2002-04-24
2
1,076 Views
Last Modified: 2007-11-27
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,


<HTML>
<HEAD></HEAD>
<TITLE></TITLE>

<script>

function init()
{
     
     menus.setCapture(true)
}

function click_me()
{
     menus.innerHTML = ""
     menus.releaseCapture()
     alert(menus.innerHTML)
}

</script>
<BODY>

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

</BODY onload="init()">
</HTML>

0
Comment
Question by:sorty
2 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 50 total points
ID: 6965917
Can you set the onLoad handler in the /body tag?

try this:

   <BODY onload="init()">

instead of this:

   </BODY onload="init()">
0
 

Author Comment

by:sorty
ID: 6966088
eureka! thanks,
I was staring at it for ages.. just needed the third eye.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article discusses how to create an extensible mechanism for linked drop downs.
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

756 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