向iframe中的页面传递参数

在最近项目中需要使用弹出窗口来做一些数据处理,于是使用了iframe来放一个窗口,那么参数怎么传递呢?

  1 <form action="nowamagic.php" method="post" id="px_form" enctype="multipart/form-data" target="pxifame" name="pxform">

 2 <ul>
 3 <li><id="zpx" href="#" onclick="local_action();"></a></li>
 4 <li><id="status1" href="#" onclick="local_action(1);"></a></li>
 5 <li><id="status5" href="#" onclick="local_action(5);"></a></li>
 6 <li><id="status9" href="#" onclick="local_action(9);"></a></li>
 7 </ul>
 8 </form>
 9 <iframe width="740" id="myif" name="pxifame" frameborder="0" scrolling="no" onload="this.height=300">
10 </iframe> 

javascript代码:

 1 <script language="javascript" type="text/javascript">
 2 function local_action(vaule)
 3 {
 4      //这里的作用是在不刷新页面的前提下,重置action地址
 5     document.pxform.action="nowamagic.php";                 
 6      if(1 == vaule)
 7      {
 8           //在响应页面加上GET参数后缀
 9         document.pxform.action+="?status=1";                
10      }
11      if(5 == vaule)
12      {
13           document.pxform.action+="?status=5";
14      }
15      if(9 == vaule)
16      {
17           document.pxform.action+="?status=9";
18      }
19     //提交
20      document.pxform.submit();                                  
21 }

22 </script> 

原文地址:https://www.cnblogs.com/mike442144/p/2224646.html