收藏:FLASH中键检测与右键屏蔽
2015-06-17 13:44
453 查看
原文:http://space.flash8.net/space/?591172/viewspace-708726.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta. http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FLASH中键检测与右键屏蔽</title>
<script. type="text/javascript" src="swfobject.js"></script>
</head>
<body>
<div id="flashcontent"></div>
<script. type="text/javascript">
var so = new SWFObject("FL.swf", "flash", "800", "600", "9", "#CCCCCC");
so.addParam("wmode", "opaque");
so.write("flashcontent");
function callFlash(){
//alert("中键");
document.getElementById("flash").onClick();
}
if(window.addEventListener){
window.addEventListener("mousedown",function(e){
if(e.button==1)callFlash();
//屏蔽右键
if(e.button==2){
if (e.stopPropagation) e.stopPropagation();
if (e.preventDefault) e.preventDefault();
if (e.preventCapture) e.preventCapture();
if (e.preventBubble) e.preventBubble();
}
},true);
}else{
document.getElementById("flashcontent").onmousedown=function(){
if(event.button==4)callFlash();
//屏蔽右键
if(event.button==2){
document.oncontextmenu=function(){return false;};
this.setCapture();
this.onmouseup=function(){
this.releaseCapture();
}
}
}
}
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta. http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FLASH中键检测与右键屏蔽</title>
<script. type="text/javascript" src="swfobject.js"></script>
</head>
<body>
<div id="flashcontent"></div>
<script. type="text/javascript">
var so = new SWFObject("FL.swf", "flash", "800", "600", "9", "#CCCCCC");
so.addParam("wmode", "opaque");
so.write("flashcontent");
function callFlash(){
//alert("中键");
document.getElementById("flash").onClick();
}
if(window.addEventListener){
window.addEventListener("mousedown",function(e){
if(e.button==1)callFlash();
//屏蔽右键
if(e.button==2){
if (e.stopPropagation) e.stopPropagation();
if (e.preventDefault) e.preventDefault();
if (e.preventCapture) e.preventCapture();
if (e.preventBubble) e.preventBubble();
}
},true);
}else{
document.getElementById("flashcontent").onmousedown=function(){
if(event.button==4)callFlash();
//屏蔽右键
if(event.button==2){
document.oncontextmenu=function(){return false;};
this.setCapture();
this.onmouseup=function(){
this.releaseCapture();
}
}
}
}
</script>
</body>
</html>
相关文章推荐
- Linux系统编程——特殊进程之僵尸进程
- HEVC,VP9,x264性能对比
- code::Blocks生成的dll 在 java jni 调用遇到的问题
- iOS开发UI之Quartz2D使用(绘制基本图形)
- 圆形切换按钮
- Android Studio jni编译生成so文件
- iOS中获取当前时间和日期并设置格式
- 随笔:spring+quartz定时任务(1)
- C++函数模板使用中的注意事项
- loadrunner可用许可证
- Selenium2学习-011-WebUI自动化实战实例-009-JavaScript 在 Selenium 自动化中的应用实例之一(赋值)
- Linux系统编程——进程的控制:结束进程、等待进程结束
- 记忆碎片 - 2015.06.17
- Linux系统编程——vfork() 函数详解
- linux环境下使用opencv训练级联分类器traincascade
- mini-httpd源码分析-tdate_parse.h
- fast rcnn
- 一个批量删除文件的脚本
- Python日志模块logging格式化封装
- js代码实现的简单的天数倒计时