最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to pass a parameter from a jsp to an iframe? - Stack Overflow

programmeradmin0浏览0评论

I have an jsp from which i call the iframe called iframe1 .

<iframe id="iframe1" style="display:none;" height="430" width="675" src="Myjps.jsp" ></iframe>

Now i have a parameter called myActualValue, which i am getting from a bean . Now i have to pass this parameter to iframe1 . How can I do it ?

Kindly help .

I have an jsp from which i call the iframe called iframe1 .

<iframe id="iframe1" style="display:none;" height="430" width="675" src="Myjps.jsp" ></iframe>

Now i have a parameter called myActualValue, which i am getting from a bean . Now i have to pass this parameter to iframe1 . How can I do it ?

Kindly help .

Share Improve this question asked Nov 21, 2012 at 15:26 The Dark KnightThe Dark Knight 5,58513 gold badges58 silver badges104 bronze badges 1
  • 1 Assuming the parameter is available before the above <iframe> line is rendered by the JSP, why not just add it with the src attribute as Myjps.jsp?param=value – techfoobar Commented Nov 21, 2012 at 15:28
Add a ment  | 

2 Answers 2

Reset to default 4

Pass it in the URL

src="Myjps.jsp?myval=something"

Inside first jsp:

<iframe id="iframe1" style="display:none;" height="430" width="675" src="Myjps.jsp?myActualValue=<%= myActualValue %>" ></iframe>

Inside Iframe1 (Myjps)

<script>
 var myActualValue = location.search.substring(1).split("=")[1];
</script>
发布评论

评论列表(0)

  1. 暂无评论