iframe添加点击事件
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery</title>
<style type="text/css">
</style>
<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
<script type="text/javascript">
</script>
</head>
<iframe src="http://code.artcare.com/page/light-pulses/" width="100%" height="100%" scrolling="no" frameborder="0" id="iFrame"></iframe>
<input type="text" id="btn" style="width: 0; height: 0;position: absolute; left: -100000">
<script>
var IframeOnClick = {
resolution: 200,
iframes: [],
interval: null,
Iframe: function () {
this.element = arguments[0];
this.cb = arguments[1];
},
track: function (element, cb) {
this.iframes.push(new this.Iframe(element, cb));
var _this = this;
this.interval = setInterval(function () {
_this.checkClick();
}, this.resolution);
},
checkClick: function () {
if (document.activeElement) {
var activeElement = document.activeElement;
for (var i in this.iframes) {
if (activeElement === this.iframes[i].element) { // user is in this Iframe
this.iframes[i].cb.apply(window, []);
var btn = document.getElementById("btn")
btn.focus()
}
}
}
}
};
IframeOnClick.track(document.getElementById("iFrame"), function () {
console.log(11111);
});
</script>
</html>
iframe添加点击事件的更多相关文章
- iOS开发小技巧 - label中的文字添加点击事件
Label中的文字添加点击事件 GitHub地址:https://github.com/lyb5834/YBAttributeTextTapAction 以前老师讲过类似的功能,自己懒得回头看了,找了 ...
- 【Swift 2.1】为 UIView 添加点击事件和点击效果
前言 UIView 不像 UIButton 加了点击事件就会有点击效果,体验要差不少,这里分别通过自定义和扩展来实现类似 UIButton 的效果. 声明 欢迎转载,但请保留文章原始出处:) 博客园: ...
- echart字符云之添加点击事件
// 路径配置 require.config({ paths : { echarts : 'jquery/echarts-2.2.7/build/dist' } }); // 使用EChart.js画 ...
- ThinkPHP框架下,给jq动态添加的标签添加点击事件移除标签
jq移除标签主要就是$("#要移除的id").remove();不再赘述,这里要提醒的是jq中动态添加标签后怎样添加点击事件.一般的jq添加点击事件是用这种方法$("#i ...
- 继承UIView的子控件添加点击事件
UITapGestureRecognizer*tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:selfaction:@select ...
- 如何在UILable上添加点击事件?
最近开始学习iOS开发,今天上来写第一个iOS笔记 昨天碰到一个需求,在UILable上添加点击事件,网上找了写资料,有人建议用透明的UIButton覆盖,有人建议写一个集成自UILable的类,扩展 ...
- jquery无法为动态生成的元素添加点击事件的解决方法
遇到 jquery无法为动态生成的元素添加点击事件,谷歌一下,整理一下解决方法如下: (<li>中间的元素是动态生成的), 现在想为<i>添加点击事件, 例子如下: <d ...
- Qt:添加点击事件的Label并显示图片
1.给label添加点击事件 Qt中原本的label是没有点击事件的,如果想添加点击事件的话,可以继承QLabel类并重载鼠标事件(比如mousePressedEvent),然后在鼠标事件中发送一个信 ...
- echarts对每个data[i]的图片添加点击事件
1.综述:以饼图为例,只需要对echarts对象option添加以下几行代码即可 //添加点击事件(单击),还有其他鼠标事件和键盘事件等等 myChart1.on("click", ...
随机推荐
- Linux系统下chkconfig命令使用详解
chkconfig命令可以用来检查.设置系统的各种服务 使用语法:chkconfig [--add][--del][--list][系统服务] 或 chkconfig [--level <等级代 ...
- Metasploit 内网渗透篇
0x01 reverse the shell File 通常做法是使用msfpayload生成一个backdoor.exe然后上传到目标机器执行.本地监听即可获得meterpreter shell. ...
- Spring_使用外部属性文件
beans-properties.xml <?xml version="1.0" encoding="UTF-8"?><beans xmlns ...
- curator的版本兼容问题(需注意)
Curator 存在版本兼容问题. Curator 2.x.x-兼容两个zk 3.4.x 和zk 3.5.x, Curator 3.x.x-兼容兼容zk 3.5. Versions The are c ...
- 网易编程题——Fibonacci数列
题目描述 Fibonacci数列是这样定义的: F[0] = 0 F[1] = 1 for each i ≥ 2: F[i] = F[i-1] + F[i-2] 因此,Fibonacci数列就形如:0 ...
- bootstrap下拉列表重置联动
/**添加&修改时--获取机柜号**/ function BindSelectJgh(jiguiColumnIdD, jiguiNumberIdD) { var jid = !jiguiCol ...
- bootstrap重置校验方法
$(function (){ $("select").change(function(){ $('#DepartForm').bootstrapValidator('resetFo ...
- DataStage系列教程 (Pivot_Enterprise 行列转换)
有人提到Pivot_Enterprise这个组件,之前没有用过,今天捣腾了会,写下来供以后参考,如果有什么不对的,还请多指出,谢谢! Pivot_Enterprise主要用来进行行列转换. 1 示例 ...
- c++ learning
迟到了三年的学习笔记.. 野指针:造了一个指针,不是NULL或者没有指向正经内存.比如刚造出来又不赋值,并不知道它指向了哪里 内存泄漏:造了一个指针,给他分配了空间,xxxxx,又分配了一块空间,指针 ...
- 使用IDEA将代码托管到GitHub步骤和错误解决
一.下载并安装Git版本控制工具 下载地址:https://git-scm.com/downloads 注册GitHub账号:https://github.com/ 为什么托管到GitHub要下载Gi ...