|
-
Jun 11th, 2002, 02:22 PM
#1
Thread Starter
Fanatic Member
Trapping mouse clicks on web page
Hi,
I need some code that disables mouse clicks and right clicks on the html page and another to re-enable the mouse clicks.
-
Jun 11th, 2002, 11:53 PM
#2
http://javascript.internet.com/page-...ght-click.html
In the code, insert your own variable, depending upon whose value the script may or may not execut.e
-
Jun 14th, 2002, 07:48 AM
#3
Member
<script language="JavaScript">
<!--
// No rightclick script.
// Find more great scripts and applets at the JavaFile!
// http://www.javafile.com
// Do not delete this header!
var message="Hey I Took A Long Time On This Site And You Are Not Stealing Any Of My Script!"; // Put your message for the alert box between the quotes.
// Don't edit below!
function click(e) {
if (document.all) {
if (event.button == 2) {
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>
This script disables right click, i use it a lot on my sites
<html>
<marquee behavior="alternate" width=50%> This is a test </marquee>
-
Jun 15th, 2002, 09:29 AM
#4
Addicted Member
That only works if you include the message box...there is a way to do it if you don't want a message box, I just need to find it.
What is the answer to this question?
-
Jun 15th, 2002, 10:01 AM
#5
Addicted Member
This seems to do the trick:
Code:
<script language ="javascript">
function cancelClick() {
window.event.CancelBubble = true;
window.event.returnValue = false;
}
document.oncontextmenu=cancelClick;
</script>
What is the answer to this question?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|