Solved

setCapture()

Posted on 2002-04-24
2
1,065 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now