js实现刷新iframe的方法汇总
javascript实现刷新iframe的方法的,现在假设存在狼蚁网站SEO优化这样一个iframe,则刷新该iframe的N种方法有
<iframe src="1.htm" name="ifrmname" id="ifrmid"></iframe>
第一种方法:用iframe的name属性定位
<input type="button" name="Button" value="Button" onclick="document.frames('ifrmname').location.reload()">
或者
<input type="button" name="Button" value="Button" onclick="document.all.ifrmname.document.location.reload()">
第二种方法:用iframe的id属性定位
<input type="button" name="Button" value="Button" onclick="ifrmid.window.location.reload()">
第三种方法:当iframe的src为其它网站地址(即跨域操作时)
<input type="button" name="Button" value="Button" onclick="window.open(document.all.ifrmname.src,'ifrmname','')">
父页面中存在两个iframe,一个iframe中是一个链接列表,其中的链接指向另一个iframe,用于显示内容。现在当内容内容添加后,在链接列表中添加了一条记录,则需要刷新列表iframe。
在内容iframe的提交js中使用parent.location.reload()将父页面全部刷新,因为另一个iframe没有默认的url,只能通过列表选择,所以只显示了列表iframe的内容。
使用window.parent.frames["列表iframe名字"].location="列表url"即可进刷新列表iframe,而内容iframe在提交后自己的刷新将不受影响。
document.frames("refreshAlarm").location.reload(true);
document.frames("refreshAlarm").document.location.reload(true);
document.frames("refreshAlarm").document.location="";
document.frames("refreshAlarm").src="";
注意区别document.all.refreshAlarm 或 document.frames("refreshAlarm") 得到的是页面中那个iframe标签,所以对src属性操作有用。
document.frames("refreshAlarm").document得到iframe里面的内容,也就是""中的内容。
javascript(js)自动刷新页面的实现方法:
间隔10秒刷新一次,在页面的head标签中加入狼蚁网站SEO优化的代码段
<meta http-equiv="refresh"content="10;url=跳转的页面或者是需要刷新的页面URL地址">
定时刷新页面(间隔2秒刷新一下页面)
<script language="javascript">
setTimeout("location.href='url'",2000);//url是要刷新的页面URL地址
</script>
直接刷新页面事件
<script language="javascript">
window.location.reload(true);
//如需刷新iframe,则只需把window替换为响应的iframe的name属性值或ID属性值
</script>
直接刷新页面事件
<script language=''javascript''>
window.navigate("本页面url");
</script>
直接刷新页面事件
function abc(){
window.location.href="/blog/window.location.href";
setTimeout("abc()",10000);
}
刷新框架页
<script language="javascript">
.leftFrm.location.reload();
parent.frmTop.location.reload();
</script>
以上所述就是本文的全部内容了,希望大家能够喜欢。
编程语言
- 宿迁百度关键词排名指南:实现精准营销的关键
- 四川SEO优化怎么做网络推广
- 立昂技术备案老域名收购:如何为您的业务赋能
- 安徽百度关键词seo贵不贵,一般需要多少钱
- 吉林百度快照排名怎么做电话营销
- 多伦新手做SEO怎么做
- 甘肃优化关键词排名推广怎么做论坛营销
- 沙雅SEO网站推广:提升您的在线可见性
- 四川SEO优化如何提升销售额和销售量
- 聂荣网站排名优化:提升网站可见性的全方位指
- 涞水SEO:提升地方企业在线可见性的策略
- 辽宁百度seo排名怎样做网站排名
- 临湘哪有关键词排名优化:提升网站可见度的关
- 黑龙江百度网站优化有没有优惠
- 凉城优化关键词排名推广:提升您的网络可见性
- 萝北整站优化:提升您网站流量和排名的全面指