[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

setCapture()

Posted on 2002-04-24
2
Medium Priority
?
1,134 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 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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

826 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