而这几种似乎都没有真正意义上的屏蔽右键。而是借助其他办法,比如添加DIV等。前些日子,在大渝网上看到一些FLASH的右键。被真正的屏蔽了。由于那个时候,没时间。而这段时间,身体又太累。很久没更新博客了,觉得实在是对不起大家。正好找了一个时间,把这个研究了一下。
操作:
1、新建一JS文件,加入如下代码:
function tmh__make_ad_fodder(src, width, height)
{
src = src.replace(" ", "");
var TEMP_IMAGE = '<img src="$src$" height="$height$" width="$width$" border="0" />';
var TEMP_FLASH = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0"'
+ 'height="$height$" width="$width$">'
+ '<param name="movie" value="$src$" />'
+ '<param name="quality" value="high" />'
+ '<param name="wmode" value="opaque" />'
+ '<EMBED src="$src$" quality="high" WIDTH="$width$" HEIGHT="$height$"'
+ 'wmode="opaque" TYPE="application/x-shockwave-flash"'
+ 'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>'
+ '</object>';
return (//.swf$/gi.test(src) == true ? TEMP_FLASH : TEMP_IMAGE)
.replace(//$src/$/gi, src)
.replace(//$width/$/gi, width)
.replace(//$height/$/gi, height)
;
}
function tmh__make_ad_content(strImageUrl, strImageName, iWidth, iHeight, strClickUrl, blClickCover)
{
var TEMP_LINK = '$ad_fodder$';
var TEMP_COVER = '<div style="width:$width$px; height:$height$px;'
+ 'position:absolute; background-color:#000000; z-index:9999;'
+ 'filter:Alpha(Opacity=0); opacity:0.0; MozOpacity:0.0; KhtmlOpacity:0.0; "></div>'
+ '$ad_fodder$';
var src = strImageName || strImageUrl;
var width = parseInt(iWidth);
var height = parseInt(iHeight);
var click_url = strClickUrl || "http://www.jalaobiao.cn/";
var ad_fodder = tmh__make_ad_fodder(src, width, height);
if (//.swf$/gi.test(src) == false) {
return TEMP_LINK
.replace(//$ad_fodder/$/gi, ad_fodder)
.replace(//$click_url/$/gi, click_url)
;
}
// flash
if (blClickCover == false) {
return ad_fodder;
}
return TEMP_COVER
.replace(//$width/$/gi, width)
.replace(//$height/$/gi, height)
.replace(//$click_url/$/gi, click_url)
.replace(//$ad_fodder/$/gi, ad_fodder)
;
}
function taoshaw_unright_shazi(strImageUrl, strImageName, iWidth, iHeight, strClickUrl, blClickCover)
{
document.write(tmh__make_ad_content(strImageUrl, strImageName, iWidth, iHeight, strClickUrl, blClickCover));
}
function tmh__show_pop_ad_content(csPopSpanObj,strImageUrl, strImageName, iWidth, iHeight, strClickUrl, blClickCover)
{
var strScript = tmh__make_ad_content(strImageUrl,strImageName,iWidth,iHeight,strClickUrl,blClickCover);
csPopSpanObj.innerHTML = strScript;
}
另存为"flash.js"。
2、在需要添加FLASH的HTML或者ASP以及其他页面中添加代码:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>default</title>
</head>
<div style="position:absolute; top:0px; left:0px;">
<script language="JavaScript" type="text/javascript" src="flash.js"></script>
<script language="javascript">taoshaw_unright_shazi('_parent', 'default.swf', '1024', '768', "", true);</script>
</div>
</body>
</html>
代码如上,显示后就可以显示网页的右键菜单了,真是牛人啊!
ZZ:http://www.missyuan.net/article/20080717/flash_35384.html