|

By Eddy R.
12-14-99
One of the major dilemmas a
web builder faces when publishing web work, is how to protect the
images and the source code (HTML or any other kind of script) he/she
creates from individuals who like to make copies of such work for
their own use (without permission).
Although there really isn't a way to keep people from copying one's
images and source code, there is something you can do to at least
discourage someone (newbies come to mind) who is trying to copy
your work.
Disable the mouse
buttons
Here is a script (JavaScript) that will allow you to disable the
mouse buttons of anyone who views any of your web pages in which
this code resides.
Disabling the Right Click button
<script language="javascript">
function click() {
if (event.button==2) {
alert('You can not use mouse buttons here.')
}
}
document.onMouseDown=click
</script>
As always, we start by defining the scripting language we are using
<script language="javascript">
Then we define the function
function click () {
Then we call the event that says: If the right button (which is
known as 2) is clicked, pop up and alert window that says "You
can't use this button here". Then we use </script> to
let the browser know where the script ends.
if (event.button==2) {
alert('You can not use mouse buttons here.')
}
}
document.onMouseDown=click
</script>
Let's go ahead and find out how to disable the Left button as well
as how to disable both buttons with the same script.
Let's
continue...
|