Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 02-18-2005, 04:07 AM   #1
Beta Member
 
Join Date: Feb 2005
Posts: 1
Default How to disable rightclick

I am loading a website in an iframe. I am in a condition that i have to disable the rightclick on the iframe after the page has been loaded.
Please help me for this situation.
__________________

thulasiram is offline   Reply With Quote
Old 02-18-2005, 05:33 AM   #2
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 7,999
Default Re: How to disable rightclick

Put this in the HTML
Code:
<script>
    function click(e) 
    {
        if (event.button == 2) 
        {
             alert("no Right Clicking Allowed!!!");
	return false;
        }
    }
document.onmousedown=click;
</script>
__________________

root is offline   Reply With Quote
Old 02-23-2005, 10:18 AM   #3
Daemon Poster
 
Join Date: Jun 2004
Posts: 511
Send a message via AIM to Denthúl Send a message via MSN to Denthúl Send a message via Yahoo to Denthúl
Default Re: How to disable rightclick

Yeah, I had a javascript one for forums. I think this might come in useful for me. Nice one root.
Denthúl is offline   Reply With Quote
Old 02-23-2005, 03:11 PM   #4
Daemon Poster
 
DevilHack's Avatar
 
Join Date: Feb 2004
Posts: 523
Send a message via AIM to DevilHack
Default Re: How to disable rightclick

Er, take off the alert, it just make's you look stupid ._.
DevilHack is offline   Reply With Quote
Old 02-23-2005, 07:25 PM   #5
Guru
 
Lord Kalthorn's Avatar
 
Join Date: Dec 2003
Location: Britain
Posts: 13,293
Send a message via MSN to Lord Kalthorn
Default

Haha - nobody likes Alerts anyway. You have to move the mouse up and across and press Ok, or move your hands to press enter. Its inconvenient.

However Devil Hack The forum can't really allow disrespectful language structure like that anymore. We have too many members now to allow it otherwise it gets seriously out of hand.
__________________
A Knight is sworn to Honour. His heart knows only Virtue. His blade defends the helpless. His might upholds the Weak. His word speaks only truth. His wrath undoes the Wicked.
Lord Kalthorn is offline   Reply With Quote
Old 02-23-2005, 07:28 PM   #6
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 7,999
Default Re: How to disable rightclick

I only put the alert in as an example that actions could be taken in the subfunction, I didn't think it was too bad considering I wrote it off the top of my head...
root is offline   Reply With Quote
Old 02-23-2005, 07:31 PM   #7
Guru
 
Lord Kalthorn's Avatar
 
Join Date: Dec 2003
Location: Britain
Posts: 13,293
Send a message via MSN to Lord Kalthorn
Default

Ah!

For explainations and debugging I suppose Alerts are useful - for seeing what's oop.
__________________
A Knight is sworn to Honour. His heart knows only Virtue. His blade defends the helpless. His might upholds the Weak. His word speaks only truth. His wrath undoes the Wicked.
Lord Kalthorn is offline   Reply With Quote
Old 02-23-2005, 11:58 PM   #8
Daemon Poster
 
DevilHack's Avatar
 
Join Date: Feb 2004
Posts: 523
Send a message via AIM to DevilHack
Default Re: How to disable rightclick

Quote:
Originally Posted by Lord Kalthorn
Haha - nobody likes Alerts anyway. You have to move the mouse up and across and press Ok, or move your hands to press enter. Its inconvenient.

However Devil Hack The forum can't really allow disrespectful language structure like that anymore. We have too many members now to allow it otherwise it gets seriously out of hand.
LOL okay i'll behave.
DevilHack is offline   Reply With Quote
Old 02-24-2005, 11:02 AM   #9
Daemon Poster
 
Join Date: Jun 2004
Posts: 511
Send a message via AIM to Denthúl Send a message via MSN to Denthúl Send a message via Yahoo to Denthúl
Default Re: How to disable rightclick

LK, I've not seen you on in a while. Probably because I don't come on much anyway.
Denthúl is offline   Reply With Quote
Old 02-24-2005, 12:06 PM   #10
Guru
 
Lord Kalthorn's Avatar
 
Join Date: Dec 2003
Location: Britain
Posts: 13,293
Send a message via MSN to Lord Kalthorn
Default

Haha. I'm always on

You know who we haven't seen on for a while? Devil Hack.

He has yet to tell us why either!
__________________

__________________
A Knight is sworn to Honour. His heart knows only Virtue. His blade defends the helpless. His might upholds the Weak. His word speaks only truth. His wrath undoes the Wicked.
Lord Kalthorn is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 07:14 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0