<!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添加点击事件的更多相关文章

  1. iOS开发小技巧 - label中的文字添加点击事件

    Label中的文字添加点击事件 GitHub地址:https://github.com/lyb5834/YBAttributeTextTapAction 以前老师讲过类似的功能,自己懒得回头看了,找了 ...

  2. 【Swift 2.1】为 UIView 添加点击事件和点击效果

    前言 UIView 不像 UIButton 加了点击事件就会有点击效果,体验要差不少,这里分别通过自定义和扩展来实现类似 UIButton 的效果. 声明 欢迎转载,但请保留文章原始出处:) 博客园: ...

  3. echart字符云之添加点击事件

    // 路径配置 require.config({ paths : { echarts : 'jquery/echarts-2.2.7/build/dist' } }); // 使用EChart.js画 ...

  4. ThinkPHP框架下,给jq动态添加的标签添加点击事件移除标签

    jq移除标签主要就是$("#要移除的id").remove();不再赘述,这里要提醒的是jq中动态添加标签后怎样添加点击事件.一般的jq添加点击事件是用这种方法$("#i ...

  5. 继承UIView的子控件添加点击事件

    UITapGestureRecognizer*tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:selfaction:@select ...

  6. 如何在UILable上添加点击事件?

    最近开始学习iOS开发,今天上来写第一个iOS笔记 昨天碰到一个需求,在UILable上添加点击事件,网上找了写资料,有人建议用透明的UIButton覆盖,有人建议写一个集成自UILable的类,扩展 ...

  7. jquery无法为动态生成的元素添加点击事件的解决方法

    遇到 jquery无法为动态生成的元素添加点击事件,谷歌一下,整理一下解决方法如下: (<li>中间的元素是动态生成的), 现在想为<i>添加点击事件, 例子如下: <d ...

  8. Qt:添加点击事件的Label并显示图片

    1.给label添加点击事件 Qt中原本的label是没有点击事件的,如果想添加点击事件的话,可以继承QLabel类并重载鼠标事件(比如mousePressedEvent),然后在鼠标事件中发送一个信 ...

  9. echarts对每个data[i]的图片添加点击事件

    1.综述:以饼图为例,只需要对echarts对象option添加以下几行代码即可 //添加点击事件(单击),还有其他鼠标事件和键盘事件等等 myChart1.on("click", ...

随机推荐

  1. Makefile文件应用——simple项目

    学习资料 本文主要参考资料:驾驭Makefile(李云).pdf 原理 (1)最基本的语法 targets: prerequisites command targets是目标,prerequisite ...

  2. AJAX基础知识点——思维导图

    如图 思维导图图片链接 http://www.edrawsoft.cn/viewer/public/s/4db2e712070147 有道云笔记链接 http://note.youdao.com/no ...

  3. neutron dhcp ha 实验

    4个节点(controller, network,2 compute nodes) 1.0   on the network node 1.1 set –I ‘s/start] on/#start\ ...

  4. 分享:JAVA各种对象

    PO:持久对象 (persistent object),po(persistent object)就是在Object/Relation Mapping框架中的Entity,po的每个属性基本上都对应数 ...

  5. Spark 宽窄依赖

    面试时被问到spark RDD的宽窄依赖,虽然问题很简单,但是答得很不好.还是应该整理一下描述,这样面试才能答得更好. 看到一篇很好的文章,转载过来了.感觉比<spark技术内幕>这本书讲 ...

  6. yii2:不使用composer安装yii2-jui的方法

    今天有一个功能需要用到autocomplete,既然用yii2开发,在这里当然使用它自带的yii2-jui中的autocomplete组件了.yii2basic版默认是没有yii2-jui组件的,需要 ...

  7. 调用http接口的工具类

    网上面有很多,但是我们项目怎么也调不到结果,试了差不多很多案例,都是报connection reset 后来,我发现是有一个验证,需要跳过验证.然后才能调接口.所以找了一个忽略https的方法.进行改 ...

  8. python3.7安装模块MySQLdb报错error: Microsoft Visual C++ 14.0 is required.

    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools&quo ...

  9. 不能在Python Console中运行pytest

    在Python Console中运行pytest发现报错了 这是为什么?因为Python Console已经是进入python之后的环境,就像在python自带的IDLE中运行pytest pytes ...

  10. Centos7安装maven过程

    下载地址 http://maven.apache.org/download.cgi 版本 apache-maven-3.3.9 -bin.tar.gz tar -xvf apache-maven-3. ...