|
|
用iframe来实现一个页面嵌套另一个页面,以此来实现页面局部动态刷新,就像AJAX做的效果。
用struts2.0做的:
<iframe id="pic" name="pic" width="100%" scrolling="no" frameborder="0" src="Page.action?returnPage=viewpicture&classId=<s:property value="#request.scene.id"/>&currPage=<s:property value="#request.currPage"/>"></iframe> 这样就可以了。
但是上面的iframe在firefox下面却不能显示出来,还有Apple Safari浏览器里面都无法显示出来。
这时候要加JS代码了
<script>var ie=!!document.all;function LoadIf(){ var doc; if(ie){ doc = frames['pic'].document; }else{ doc = document.getElementById("pic").contentWindow.document; } document.getElementById("thumbnailwrapper").innerHTML = doc.body.innerHTML;}</script>
这样就可以搞定了。 |
|