auto refresh iframe
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title> <script></script>
<style>
.gray {color:#ccc !important; background-color:#eee !important; border-color:#eee !important; }
.black { color:black !important; }
#autoRefresh_label { cursor:pointer; }
</style>
</head>
<body>
<div id="autoRefresh_div" style="-moz-user-select:none;" onselectstart="javascript:return false;">
<input type="checkbox" checked="checked" id="autoRefresh_checkbox" />
<label for="autoRefresh_checkbox" id="autoRefresh_label">
每
<select id="autoRefresh_select">
<option value="1">1分钟</option>
<option value="3" selected="selected">3分钟</option>
<option value="10">10分钟</option>
<option value="30">30分钟</option>
</select>
自动更新</label>
</div> <script> window.$$ = function (e) {
if (document.getElementById(e)) { return document.getElementById(e); }
} //父子同域才可以使用
//document.domain = '';如果父子同域后缀,则可以通过设置该属性而实现跨域访问 window.autoRefresh = function () {
this.getCurrentIframe = function () {
if (!parent || parent.document.getElementsByTagName('iframe').length === 0) {
return undefined;
}
var iframes = parent.document.getElementsByTagName('iframe');
for (var i = 0; i < iframes.length; i++) {
if (iframes[i].src === document.location.href) {
return iframes[i];
}
} } var that = this; this.init = function () { if (!parent['autoRefresh_checkbox_checked']) {
parent['autoRefresh_checkbox_checked'] = $$('autoRefresh_checkbox').checked;
}
else {
$$('autoRefresh_checkbox').checked = parent['autoRefresh_checkbox_checked'];
} $$('autoRefresh_checkbox').onchange = function () {
parent['autoRefresh_checkbox_checked'] = $$('autoRefresh_checkbox').checked; };
$$('autoRefresh_checkbox').onclick = function () { $$('autoRefresh_checkbox').checked === false
? $$('autoRefresh_select').className = $$('autoRefresh_label').className = 'gray'
: $$('autoRefresh_select').className = $$('autoRefresh_label').className = 'black';
} if (!parent['autoRefresh_select_selected']) {
parent['autoRefresh_select_selected'] = $$('autoRefresh_select').value;
}
else {
$$('autoRefresh_select').value = parent['autoRefresh_select_selected'];
}
$$('autoRefresh_select').onchange = function () {
parent['autoRefresh_select_selected'] = $$('autoRefresh_select').value;
this.start();
}; } this.start = function () {
var time = parseInt($$('autoRefresh_select').value) * 1000 * 60;
setInterval(function () {
if ($$('autoRefresh_checkbox').checked) {
that.getCurrentIframe().src = document.location.href;
}
}, time);
} this.init();
} new autoRefresh().start(); </script>
</body> </html>
if you put these codes in the iframe,then iframe can refresh auto.
auto refresh iframe的更多相关文章
- acm对拍程序 以及sublime text3的文件自动更新插件auto refresh
acm等算法比赛常用---对拍 以及sublime text3的文件自动更新插件auto refresh 对拍 对拍即程序自动对比正确程序的运行结果和错误程序的运行结果之间的差异 废话少说, 直接上操 ...
- iframe父子页面之间相互调用元素和函数
<!doctype html> <html> <head> <meta http-equiv="Content-Type" content ...
- iframe参数
iframe参数: <iframe src="test.jsp" width="100″ height="50″ frameborder="no ...
- iframe的各项參数
iframe的各项參数: <iframe src="test.jsp" width="100″ height="50″ frameborder=" ...
- Markdown中如何插入视频 > iframe?
关于Markdown中如何插入视频这一问题 网上众说纷纭,一直也没找到一个确切的答案,想来也是,这些东西毕竟还不算成熟.各种以前提供过的方法现在来讲,可能在更新或是关闭大潮中又没了 而且,Ma ...
- iframe标签用法详解
功能:iframe标签用于定义内联框架. 语法:<iframe></iframe> 内联框架是在一个页面中嵌入另一个页面. 有很多网页看上去是一个网页,但实际上它其中可能镶 ...
- vue组件中使用iframe元素
需要在本页面中展示vue组件中的超链接,地址栏不改变的方法: <template> <div class="accept-container"> <d ...
- iframe使用大全
<iframe src=”you page’s url” width=”100″ height=”30″ frameborder=”no” border=”0″ marginwidth=”0″ ...
- Iframe 用法的详细讲解
1转自:https://blog.csdn.net/judyge/article/details/51786064 zIframe 用法的详细讲解 把iframe解释成“浏览器中的浏览器“很是恰当 & ...
随机推荐
- linux原始套接字(2)-icmp请求与接收
一.概述 上一篇arp请求使用的是链路层的原始套接字.icmp封装在ip数据报里面,所以icmp请 ...
- Debian Environment Variables
原文:EnvironmentVariables General Environment variables are named strings available to all application ...
- java中的io系统详解 - ilibaba的专栏 - 博客频道 - CSDN.NET
java中的io系统详解 - ilibaba的专栏 - 博客频道 - CSDN.NET 亲,“社区之星”已经一周岁了! 社区福利快来领取免费参加MDCC大会机会哦 Tag功能介绍—我们 ...
- [转]Oracle 修改或者删除临时表 ORA-14452: 试图创建, 更改或删除正在使用的临时表中的索引
本文转自:http://blog.csdn.net/treasurelifelhf/article/details/7290729 由于存储过程出现问题,导致前台页面无法显示数据.执行存储过程发现临时 ...
- TopCoder SRM 639 Div.2 500 AliceGameEasy --乱搞
题意: 一个游戏有n轮,有A和B比赛,谁在第 i 轮得胜,就获得 i 分,给出x,y,问A得x分,B得y分有没有可能,如果有,输出A最少赢的盘数. 解法: 这题是我傻逼了,处理上各种不优越,要使n*( ...
- KEngine:Unity3D资源的打包、加载、调试监控
资源模块做什么? 资源模块——ResourceModule,是KEngine中最核心的模块,其他模块基本或多或少的对它有依赖,它主要的功能是:资源打包.路径定义.资源管理.资源调试. 资源模块对Uni ...
- Google类VR设备知识
前言 本文所指的google类vr设备是指: 谷歌的Cardboard.三星Gear VR.暴风魔镜等这样的手机VR盒子,而并不是HTC Vive这类. 人眼立体感知能力 人的左右眼看到的东西是有差别 ...
- 使用SQL如何把用逗号等字符隔开的字符串转换成列表(转)
如何把用逗号等字符隔开的字符串转换成列表,下面依逗号分隔符为例: 比如有一个字符串,其值为:香港,张家港,北京,上海用SQL把这个字符串转换成列表的方法是: 1.方法一 WITH A AS (SELE ...
- web cache server方案比较:varnish、squid、nginx
linux运维中,web cache server方案的部署是一个很重要的环节,选择也有很多种比如:varnish.squid.nginx.下面就对当下常用的这几个web cache server做一 ...
- Memcached和Memcache安装(64位win7)
一.Memcached和Memcache的区别: 网上关于Memcached和Memcache的区别的理解众说纷纭,我个人的理解是: Memcached是一个内存缓存系统,而Memcache是php的 ...