ManyCodes.com – codes & scripts Get free programming codes and tutorials!

29Jul/090

How to prevent or stop right click on your website

Here is how you can prevent right click on your website. This will stop people from looking at the source code of your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com -->
<SCRIPT language=JavaScript>
document.onmousedown=click
var times=0
var times2=10
function click() {
if ((event.button==2) || (event.button==3)) {
if (times>=1) { bye() }
alert("No right clicking!!!!!! don't do it again..");
times++ } }
function bye() {
alert("I said NO right clicking! click ok to exit LMAO!");
bye() }
</SCRIPT><font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
29Jul/090

How to show an alert by click (msg box) on your website

Here is how you can show an alert by click (msg box) on your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com --><!-- Start of Message Alert -->
<!-- Use this button in a form to pop-up a message when the user clicks it -->
<form>
<input type="button" value="message" onClick="alert('YOUR MESSAGE GOES HERE'); return true">
</form>
<!-- End of Message Alert -->
<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
22Jul/091

Don’t let the user use right click on mouse

Here is how you can disable right-click on your webpage.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<pre><!-- this script is from www.manycodes.com --></pre>
</style>
<SCRIPT language=JavaScript>
document.onmousedown=click
var times=0
var times2=10
function click() {
if ((event.button==2) || (event.button==3)) {
if (times>=1) { bye() }
alert("No right clicking!!!!!! don't do it again..");
times++ } }
function bye() {
alert("I said NO right clicking! click ok to exit LMAO!");
bye() }
</SCRIPT>
<pre>
<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font></pre>
Tagged as: , , , , , , , , 1 Comment