Webmaster Cash Program
 Upload & Sell Your Software
Upload & Sell Your Ebook
 Enter The AWT Service Center  Contact Applied Web Tools
 Purchase Some Advertising  Password Troubles? Click Here!
Knowledge Center
Want to write for Applied Web Tools? Send your Writer's Query to
Editor@AppliedWebTools.net for details.
HTML
Reference
&
Tutorial
CSS
Reference
&
Tutorial
DOM
Reference
&
Tutorial
JavaScript
Reference
&
Tutorial
50+ Programming Examples
Use HTML, CSS, DOM & JavaScript Together
Misc. Essays & Documents
You'll Find Just About Anything In Here
50+ Web Page Constructions
Learn the Art of Using HTML, CSS, DOM & JavaScript Together
 Changing Background Colors
 Event Triggering With onLoad
 Disabling The Right Click
 DOM Driven Color Changing
 Switching Images
 innerHTML Attribute Access
 Change With innerHTML
 Changing Positions
 Change Position With onMouseMove
 Change Text Position
 Interactivity Skills
 Type-writing A Message
 Auto-changing Text Size
 Making Text Scroll
 Blinking Text
 Simple Form Authentication
 Change Background Color Of An INPUT
 Change Text Color Of An INPUT
 Change Background Image Of An INPUT
 Select All Checkboxes
 Select Color Of The Submit Button
 Change Text Color Of A Submit Button
 Insert Background Image To A Button
 Change Color Of Drop Down List
 Change Text Color Of A Drop Down List
 Change Color Of A TEXTAREA
 Change The Text Color Of A TEXTAREA
 Insert An Image Into A TEXTAREA
 Change The Size Of An Image
 Change The Source Of An Image
 Change The Position Of An Image
 Change The Background Image
 Moving Images Around The Page
 Drag & Drop An Image
 A Simple Image Viewer
 A Shaking Image
 A Digital Clock
 Drop Down List Link
 Top Drop Down Menu
 Always On Top Menu
 Inset Border Buttons
 A Description Generating Menu
 An Image Generating Menu
 A Horizontal Sliding Menu
 A Click Horizontal Sliding Menu
 Returning Cursor Co-ordinates
 Making Text Follow The Cursor
 Attaching An Image To The Cursor
Right Click

Disabling the Right Click function of a browser can be fun. The objects and methods the browser uses to allow things such as a right click can be accessed directly in a few cases. This is one of them. You can use this function to limit what the user is allowed to do. This is handy if you have an embedded video file and you don’t want to offer the user the chance of saving it to their computer’s hard drive or directly to an Internet URL.

<html>
<head>

<script type="text/javascript">

document.onmousedown=disable; //IE
message="Right Click functions have been disabled.\nNow you cannot view my source\n and you cannot steal my images";

function disable(e) {
if (e == null) { //IE disable
e = window.event;
if (e.button==2) {
alert(message);
return false;
}
}
document.onclick=ffdisable; //FF
}

function ffdisable(e) {
if (e.button==2) { //firefox disable
e.preventDefault();
e.stopPropagation();
alert(message);
return false;
}
}

</script>
</head>

<body>

<p>Right-click on this page to trigger the event.</p>
<p>Note that this does not guarantee that someone won't view the page source or steal the images.</p>

</body>
</html>

v Note the addition of an extra line of instructions to provide for the Internet Explorer function. It’s always a good idea to provide for older browsers. Cross platform and cross version compatibility are extremely important. When the user uses the right mouse button, the first directive on the first line is consulted: an onMouseDown event. Provision for FireFox has been included, using the preventDefault and stopPropagation directives. After any of the directives has been completed, a status of false is returned and the contents of the message variable are displayed in an alert box.
tr>
Want a copy of the Applied Web Tools Knowledge Center on your site?

Over 1200 individual command definitions in a really cool interface

Send your query to Sales@AppliedWebTools.net for details
I do not employ cookies or tracking devices of any kind