Home arrow JavaScript arrow Page 9 - Understanding The JavaScript Event Model (part 2)

Reducing The Crime Rate - JavaScript

In this concluding article on the JavaScript event model, findout how the Event object can be used to do ever more complex things,including manipulating the dimensions of a Web page and tracking andintercepting keyboard and mouse events.

TABLE OF CONTENTS:
  1. Understanding The JavaScript Event Model (part 2)
  2. Back To Basics
  3. How's The Weather Up There?
  4. X Marks The Spot
  5. Enter The Stalker
  6. Of Keys And Clicks
  7. A Few Modifications
  8. Tonight's Menu
  9. Reducing The Crime Rate
  10. Endgame
By: Team Melonfire, (c) Melonfire
Rating: starstarstarstarstar / 32
July 10, 2002

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
Ever been to a Web site and tried "borrowing" the JavaScript (by right-clicking and trying to view the source of the page), only to get a little dialog box asking you to cease and desist? Well, it's time for you to get back at all those goody two-shoes, by adding your own little security measures to your site.

<html>
<head>
<script language="JavaScript">
function noRightClick()
{
if(event.type == 'mousedown' && event.button == 2)
{
alert("Sorry, your right mouse button has been
disabled.");
}
}
document.onmousedown = noRightClick;
</script>
</head>
<body>
</body>
</html>
In this case, every time the user clicks the right mouse button, the event will be intercepted by the noRightClick() function, and the normal system behaviour will be replaced with an alert box containing a cease-and-desist message. This usually has more decorative value than anything else - any reasonably adept Web user can still get to the source of your Web page - but it serves to demonstrate the basic concept here.

 
 
>>> More JavaScript Articles          >>> More By Team Melonfire, (c) Melonfire
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

JAVASCRIPT ARTICLES

- Javascript for Beginners: An Introduction
- Introduction to JavaScript
- Adding Elements to a Tree with TreeView jQue...
- Using the Persist Argument in a TreeView jQu...
- Using Unique and Toggle in a TreeView jQuery...
- Using Event Delegation for Mouseover Events ...
- Using the Animate Option in a Treeview jQuer...
- Using HTML Lists with Event Delegation in Ja...
- Opened and Closed Branches on a TreeView jQu...
- Mouseover Events and Event Delegation in Jav...
- Creating a TreeView JQuery Hierarchical Navi...
- Event Delegation in JavaScript
- A Look at the New YUI Carousel Control
- Working with Draggable Elements and Transpar...
- Displaying Pinned Handles with Resizable Con...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: