主页面中嵌套了iframe,想把请求的结果传入到iframe中。但我不想用session,有什么办法能够把request.setAttribute("info",info);的值传递给iframe么。感觉iframe是第二个页面一样,request只能将值传递给主页面
2条回答 默认 最新
- g_johnson_lee 2010-04-28 16:28关注
试试下面代码:
[code="HTML"]
var list = [ <% List list = (List) (request.getAttribute("promotionlist")); for (Iterator it = list.iterator; it.hasNext();) { out.print("\"" + it.next() + "\""); if (it.hasNext()) out.println(", "); } %> ]; document.getElementById("iframeContent").promotionList = list;[/code]
然后到iframe页面,从iframe中取值
[code="JavaScript"]
var list = window.top.frames["promotionlist"].promotionList;
[/code]本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报