|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I've got a script that creates a drop down menu with a button click. I want to be able to collapse the menu with a mouse click anywhere on the document. How do I capture that? Help a rookie would ya?
|
|
#2
|
|||
|
|||
|
The script below pops up an alert box on a right mouse click or on a hold left/click right sequence. You can replace the alert function with whatever you need to collapse your menu. If you really want to collapse the menu with the left button as well (really?), you can add those button strokes.
RKM <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- // block the right mouse click on the page var message="YOUR MESSAGE" function click(e) { //3.0 if (document.all) { if (event.button == 2 | | event.button == 3 | | event.button == 6 | | event.button == 7) { alert(message); return false; } } if (document.layers) { if (e.which == 3) { alert(message); return false; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=click; // --> </SCRIPT> |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Capture mouse click on document window |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|