最近用到一个小功能,即双击相册列表中的照片时,把此照片设为头像,由于我用的是iframe,所以在action处理过后返回的jsp页面不能达到父页面的刷新。
IPictureMgr pictureMgr = (IPictureMgr) getBean("pictureMgr");
List result = pictureMgr.get(username);
req.setAttribute("result", result);
req.setAttribute("filepath", filepath);
return mapping.findForward("add");
如果这样的话每次只能手动刷新整个页面才能实时显示修改的头像,如果想刷新父页面,只需要在script中做如下处理:
function aaaa(i,filename){
alert(i);
var filepath = document.getElementById("picture"+i).value;
alert(filepath);
window.location.href ='pictures.do?method=sethead&filepath='+filepath+'&filename='+filename;
parent.location.reload();//刷新父页面
}
这是双击事件function
iframe提交action处理后刷新父页面&在action中控制页面刷新
最新推荐文章于 2023-12-12 22:18:37 发布
本文介绍了一种在iframe内部操作后刷新外部父页面的方法,通过JavaScript实现双击更改头像后的页面即时更新效果。
1328

被折叠的 条评论
为什么被折叠?



