日期:2014-05-17  浏览次数:20792 次

新人弱弱的问下局部刷新问题~~
假设有A.htm、B.htm两页,A.htm:
<div id=aaa></div><iframe width=0 height=0src=b.htm></iframe>
B.htm:
<script>parent.aaa.innerHTML='test!'</script>

那我如何在A页面刷新B页面呢?

------解决方案--------------------
引用:
引用:
ajax,或者jquery解决吧,很简单的。
ajax不太清楚如何传图片出来~~~


在子页面里通过js往父页面传递图片的path,在父页面里顶一个隐藏域来接收这个对应的路径,这样就能是实现图片浏览了

  <c:if test="${!empty(requestScope.path)}">
  <script>
  parent.document.getElementById("path").value="${requestScope.path}";
  parent.document.getElementById("view").innerHTML="<img src=\"${pageContext.request.contextPath}/${requestScope.path}\" height='200 width='200'/> "
  </script>
  </c:if>

[code=text]
<tr>
<td>
图片
</td>
<td>
<iframe
src="${pageContext.request.contextPath }/upload.jsp?path=${requestScope.product.path}"
width="100%" height="25" marginheight="0" marginwidth="0"
scrolling="no" frameborder="0"></iframe>
</td>
</tr>
<tr>
<td>
浏览
</td>
<td id="view">
<c:if test="${empty(requestScope.product.path )}">
&nbsp;
</c:if>

<c:if test="${!empty(requestScope.product.path)}">
<img
src="${pageContext.request.contextPath }/${requestScope.product.path}"
width="200" height="200" />
</c:if>

</td>
</tr>

[/code]
------解决方案--------------------
http://bbs.csdn.net/topics/390359666
我之前也碰到类似的问题,可以看看我这个帖子,希望对你有帮助!