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", ...
随机推荐
- Spring_通过注解配置 Bean(2)
- PAT1037. Magic Coupon (25)
#include <iostream> #include <algorithm> #include <vector> using namespace std; in ...
- c语言字符处理函数常见使用集合
1.最近看一些开源项目代码时,总会看到 c 语言中一些 "str" 开头的处理字符串的用法,有的之前没用到过,特此记录,随时看到随时添加. 这里不提出源码,只是一些使用说明加例子 ...
- 使用VirtualBox安装Android 4.2.2 x86 .
http://blog.csdn.net/kunoy/article/details/8768205 virtual box 安装 android x86 不显示鼠标, --> 控制 --> ...
- Spring -- spring整合struts2
1. 概述 spring和struts整合: 1.创建web程序 2.引入struts2类库. 3.创建HelloWorldAction package cn.itcast.struts2.actio ...
- rabbitmq High Availability
每个rabbitmq node运行RabbitMQ application,共享用户virtual hosts, queues, exchanges, etc. 一个nodes组称之为一个集群. 所有 ...
- 关于angularJS的$watch的 一些小用法
$watch方法,它可以帮助我们在每个scope中监视其中的变量. $watch 单一的变量 对于普通的变量时,如数字,字符串等,直接如下写是可以监视到变量的变化,并执行相应的函数的. $scope. ...
- 使用mybatis如果类属性名和数据库中的属性名不一样取值就会为null
使用mybatis时如果类属性名和数据库中的属性名不一样取值就会为null 这是不能再去改变javabean中的属性,只能改变sql语句.语句如下所示: <select id="sel ...
- ssh整合学习(1)
Hibernate框架 1 hibernate核心配置文件 (0)orm思想 -对象关系映射 (1)数据库信息 (2)hibernate信息 (3)映射配置 (4)hibernate核心配置文件 -如 ...
- STDIN_FILENO
1.STDIN_FILENO的作用STDIN_FILENO属于系统API接口库,其声明为 int 型,是一个打开文件句柄,对应的函数主要包括 open/read/write/close 等系统级调用. ...