HOME
          About US
          Contact Us

On Twice Mouse Click

Chapter - 13 : On Mouse & On Key Commands (On Twice Mouse Click): (Page 2/5)


(Cotinued from previous page)

To Confirm an Input - let say you have captured some data in a form. Now before submit, you want your visitor to confirm (you might have noticed it in many web sites). You have to move on a particular button and press the mouse.

'On Mouse Down' and 'On Mouse Up' Command: As you may have noticed that, the mouse click is a combination of 'first the click button going down' and then 'coming up'. Similarly, this command (onclick) is basically a combination of 'On Mouse Down' and 'On Mouse Up' command. If you want to your web page to be sensitive to both of these movement, then

onmousedown='somefunction1()' - This will be activated as soon as the mouse button is pressed.
onmouseup='somefunction2()' - This will be activated as soon as the mouse button is released.


13.2- On Double Mouse Click: This is same in function as 'Mouse Click'. You might have noticed that in a web page some function activates on 'one click' and some on 'double click'. This also has the command as ondblclick='somefunction();'

In your onclick command change the 'onclick' with 'ondblclick'

13.3- Stopping Right Mouse Click: The right mouse click has got a standard display, as per window already opened. But if you want to stop your visitor for right click (this is mostly used to stop your visitor to 'copy' from the web screen)

Command: <script language=JavaScript> var message = "function disabled : if you want this picture - contact us"; function rtclickcheck(keyp){ if (navigator.appName == "Netscape" && keyp.which == 3) { alert(message); return false; } if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) { alert(message); return false; } } document.onmousedown = rtclickcheck; </script>

On  Click Output: Now if visitor 'Right Clicks' on the web page, browser will show the massage as per FIG- 13.2

(Cont......... to next page (Pg-3))

On Twice Mouse Click
© funandhobby.com (On Twice Mouse Click)