?
Solved

setCapture()

Posted on 2002-04-24
2
Medium Priority
?
1,100 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
[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 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 200 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
Suggested Courses

800 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