在silverlight中禁用html查看器中的右键单击选项

时间:2012-04-23 08:53:21

标签: silverlight

我想在silverlight中禁用html查看器上的右键单击选项。接受你可以避免右键单击silverlight页面,但是当我右键单击html查看器时,我右键单击选项。我不想要在html viewer中使用右键单击选项。任何人都可以帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

看看这段代码 -

<SCRIPT language=JavaScript>
<!-- http://www.spacegun.co.uk -->
    var message = "function disabled"; 
    function rtclickcheck(keyp){ if (navigator.appName == "Netscape" && keyp.which == 3){   alert(message); return false; } 
    if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) {  alert(message);     return false; } } 
    document.onmousedown = rtclickcheck;
</SCRIPT>

以及这个例子:

<SCRIPT TYPE="text/javascript"> 
<!-- 
//Disable right click script 
var message="Sorry, right-click has been disabled"; 
/////////////////////////////////// 
function clickIE() {if (document.all) {(message);return false;}} 
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) { 
if (e.which==2||e.which==3) {(message);return false;}}} 
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} 
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} 
document.oncontextmenu=new Function("return false") 
// --> 
</SCRIPT> 

取自帖子:

http://rainbow.arch.scriptmania.com/scripts/no_right_click.html

http://www.hypergurl.com/norightclick.html