<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > |
<html xmlns= "http://www.w3.org/1999/xhtml" > |
<head> |
<meta http-equiv= "Content-Type" content= "text/html; charset=utf-8" /> |
<title>局部刷新iframe</title> |
<style type= "text/css" > |
#iframeid { |
height: 500px; |
width: 800px; |
} |
</style> |
</head> |
<body> |
根据iframe的name属性刷新 |
<input type= "button" name= "Button" value= "刷新" onclick= "document.frames('iframename').location.reload()" > |
<br /> |
根据iframe的id属性刷新 |
<input type= "button" name= "Button" value= "刷新" onclick= "iframeid.window.location.reload()" > |
<br /> |
<br /> |
<br /> |
跨域操作:<br /> |
<br /> |
刷新 |
<input type= "button" name= "Button" value= "刷新" onclick= "window.open(document.all.iframename.src,'iframename','')" > |
<br /> |
设置iframe的src来实现局部刷新 |
<input type= "button" name= "Button" value= "刷新" onclick= "document.getElementById('iframeid').src='http://yuncode.net'" > |
<br /> |
<br /> |
<iframe src= "http://yuncode.net" name= "iframename" id= "iframeid" ></iframe> |
</body> |
</html> |
高级设计师
by: 小蜜锋 发表于:2012-10-05 17:48:39 顶(0) | 踩(0) 回复
前两个不能跨域操作!
回复评论