0

我正在使用拖曳页面,一个是父页面,另一个是子窗口页面,用于将单选按钮值从子窗口页面传递到父页面,但我在父页面文本字段中出现错误未定义...

父页面

<form method="post" action="" name="f1">
<table border=0 width=550>
    <tr>
        <td>
            Your Name
            <input id="OPRID" name="OPRID" type="text" value="<?php echo (isset($_POST

         ['OPRID']) ? $_POST['OPRID'] : ""); ?>" /> 
            <a href="javascript:void(0);" name="My Window Name" title=" My title here "  

   onClick="window.open  
    ('popwindow.php','Ratting','width=650,height=550,0,status=0,scrollbars=1');" />
                Click here to open the child window
            </a>
        </td>
    </tr>
</table>
</form>

**child window page** 

<html>
 <head>

 <script langauge="javascript">
  function post_value(){
  opener.document.f1.OPRID.value = document.frm.OPRID.value;
  self.close();
    }
   </script>
   <form name="frm" method="post" action=''>
  <tr>  
   <td><div align="center">
  <input type="radio" name="OPRID" id="radio" value="<?php echo $objResult ["OPRID"];? 
   >" /></div></td>  
   <td><div align="center"><?=$objResult["OPRID"];?></td>
   <td><div align="center"><?=$objResult["OPRDEFNDESC"];?></td>
   </tr>
    <?  
    }  
   ?>  
    </table>  
  <br />

  <tr> 
  <td><div align="center"> <input type="button" value='Submit' onclick="post_value();"> </div>
   </td>
    </tr> 
    </form>
 but in text fields i have getting undefined error.
4

2 回答 2

0

用这个

window.opener.document.f1.OPRID.value = document.frm.OPRID.value;

而不是这个

opener.document.f1.OPRID.value = document.frm.OPRID.value;

希望这可以帮助...

于 2013-10-25T18:24:18.247 回答
0

您想要实现的目标可以使用 HTML5 sessionStorage 功能来完成。

检查此链接: http: //playground.html5rocks.com/#sessionstorage

于 2013-10-23T10:51:00.873 回答