473,499 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Disable left mouse button with out alert message

49 New Member
Hai guys,

I want the the code to disable Left Mouse button with out Alert message.

Below code i am having

Expand|Select|Wrap|Line Numbers
  1. <!-- This code is for disableing left click-->
  2. <script language="javascript">
  3. function noClick() {
  4. if (event.button==1) {
  5. alert('You cannot click')
  6. }
  7. }
  8. document.onmousedown=noClick
  9. </script>
  10.  
i am having the above code with alert mesage.so can any one disable the alert message form the above code ? or send some other code for disable left mouse button with out alert message.
It's urgent.

Thanks,
Nagesh.
Sep 12 '08 #1
3 9599
Ferris
101 New Member
Hi
[HTML]
<script language="javascript">
function noClick() {
if (event.button==1) {
return false;
alert('You cannot click');
}
}
document.onmousedown=noClick;
</script>
[/HTML]

you mean this? or you want to forbidden user click in your web page?
Sep 12 '08 #2
acoder
16,027 Recognized Expert Moderator MVP
The code is not cross-browser. 'event' is not global in most browsers.

Try something like this instead (right mouse detect).

The language attribute is deprecated. Use type="text/javascript" instead.
Sep 12 '08 #3
nagmvs
49 New Member
The code is not cross-browser. 'event' is not global in most browsers.

Try something like this instead (right mouse detect).

The language attribute is deprecated. Use type="text/javascript" instead.

Thanks for ur reply.
Sep 12 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
9634
by: Lijun Yang | last post by:
Hey, I am able to disable the right mouse button on images for netscape and IE but it won't work for Opera. Here is the code: // start of the code var clickmessage="Sorry, you don't have...
9
2857
by: Dennis Allen | last post by:
Hi. What's the best way to display an image, disabling the user's ability to right-click on it? I believe you have to use <body oncontextmenu="return false">. Would the following work? var...
4
2076
by: Lakshmi Narayanan | last post by:
hi all, i have this problem.i want the user of my page to only click the link with the right mouse button and open a word document using the open in new window option.if he clicks on the left...
6
3137
by: nntp | last post by:
I have a set of links which I want search engines to crawl them, but I want to disable them from my visitors, so I will ask the link owners to pay me to let me enable them. <a disabled...
22
6928
by: Matt | last post by:
When browsing a web page a user has the ability to highlight content on a page (by holding down the left mouse button and dragging the mouse over the desired content). Is there a way to disable...
4
2262
by: Seen | last post by:
This has probably been covered before but I can't seem to find it. I want to disable the user from using the right mouse button that brings up a windown menu of options. How's it done?????
8
3661
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? -----------------------------------------------------------------------...
18
3914
by: Shocky | last post by:
Hi there, I am trying to detect whether my IE6 users have pressed both right and left mouse buttons simultaneously in my Javascript code, by using: if(event.button==3) {alert("Both right and...
16
6630
by: nagmvs | last post by:
Hi, Can any one tell me How to disable Keyboard Functions using JavaScript.If knows please tell me the code.Also tell me the code for mouse disable also. Thanks, Nagesh.
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
297
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.