View Full Version : question about using HTML code in Disable right mouse click script

11-12-2014, 08:25 AM
I am using your Disable right mouse click script on a website and was wondering if it is possible to place HTML code in the message appearring on screen.
I have tried with a <br /> to "cut" the line in two, but the only reslut is that <br /> is now appearring in the message.

The complete message is: Copyright name owner site. All rights reserved. Please contact me for licensing information.
I would lik to have he last line (Please contact me for licensing information.) on the second line in the message.

Is there a way somebody can help me out with this?

11-12-2014, 09:38 PM
Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

11-12-2014, 11:54 PM

Copyright name owner site. All rights reserved. \nPlease contact me for licensing information.

11-13-2014, 06:55 AM
Thanks, now there are 2 lines.
In order the first question: is it also possible to line the text in the center?
HTML would say <center>, but perhaps there is another code for this?

11-13-2014, 02:21 PM
No, you can't center the text, because it shows in a standard alert.
You can make a custom alert, though, which allows normal HTML. Try this script (in the head of your page):

<script >
function disable_rc()
if(!document.getElementById('disable_rc')){document.body.innerHTML+="<div id='disable_rc' style=\'position:fixed;top:50%;left:50%;\'><\/div>"; }
document.getElementById('disable_rc').innerHTML='<div style="position: fixed; margin-left: -165px; margin-top: -25px;" ><div style="position: fixed; color: white; background: grey; cursor: pointer; padding-left: 2px; padding-right: 2px; font-family: verdana; font-size: 13px; font-weight: bold;z-index: 1; margin-top: 0px; margin-left: 320px" onclick="document.getElementById(\'disable_rc\').innerHTML=\'\'">X<\/div><\/div><br><iframe name="ifr" id="ifr" style="position: fixed;left: 50%; top: 50%;width:333px;margin-left: -165px;margin-top: -25px;height:50px;border: 1px solid silver" frameborder="0" onload="frames[\'ifr\'].document.body.innerHTML=\'<span style=&quot; font-family: verdana; font-size: 12px; display: block; text-align: center;&quot;>Copyright name owner site. All rights reserved. <br>Please contact me for licensing information.</span>\'"></iframe>';return false;

if (document.addEventListener) {
document.addEventListener('contextmenu', function(e) {
}, false);
} else {
document.attachEvent('oncontextmenu', function() {
window.event.returnValue = false;