绿色资源网:您身边最放心的安全下载站! 最新软件|热门排行|软件分类|软件专题|论坛转帖|厂商大全

绿色资源网

技术教程
您的位置:首页网页设计网页特效 → JS实现刷新iframe的方法

JS实现刷新iframe的方法

我要评论 2012/06/25 11:17:42 来源:绿色资源网 编辑:downcc.com [ ] 评论:0 点击:287次

<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','')">

关键词:JS,iframe

阅读本文后您有什么感想? 已有 人给出评价!

  • 3 欢迎喜欢
  • 5 白痴
  • 6 拜托
  • 74 哇
  • 4 加油
  • 2 鄙视