ITeye博客

iframe 的刷新方式,这样方式更方便。

llhdf · 2010-02-11 13:49 · Html · Web前端 · Markdown

iframe的刷新方式

  1. 刷新方式可以使用 javascript 的 document.fr.location.reload()

  2. 还有就是修改 document.fr.location.href 也可以实现刷新的功能

例如:

<iframe name="fr" width="96%" src="alert_search.do?method=findSys"></iframe>

<script type="text/javascript">
	function show_syslog(id){
		document.fr.location.href="/alert_search.do?method=findSys&id="+id;				
	}
</script>
<input type="button" onclick="javascript:show_syslog(1)">

注意:千万不要两种方式同时使用,如果同时使用,将会提交两次。

document.fr.location.href = "your.html"; 
document.fr.location.reload();

评论(8)

  1. #8 楼 · wtotal · 2010-02-20 13:40

    提交过一次的form,怎么不提交刷新?

  2. #7 楼 · wangliang_gz · 2010-02-20 11:38

    让iframe进来的页面自己刷新不就行了吗? 用

  3. #6 楼 · kaki · 2010-02-18 01:45

    谢谢,我正需要。

  4. #5 楼 · smzd · 2010-02-17 10:09

    可以回复了吗?不关小黑屋了?

  5. #4 楼 · 习惯在马桶上思考 · 2010-02-15 17:14

    做技术的人。。。。

  6. #3 楼 · rainsilence · 2010-02-14 09:33

    国外出差的路过。。。。

  7. #2 楼 · 寄生虫 · 2010-02-14 08:51

    如果iframe中存在form表单,并且提交过一次,这种刷新都会提示重复提交。 大年初一啦,给大家拜年。

  8. #1 楼 · shenliu · 2010-02-14 08:33

    我是用 document.fr.src="/alert_search.do?method=findSys&id="+id的,这样不好吗?

评论功能维护中,当前仅展示历史评论。