Problem in passing value from child window to parent window in Javascript
I'm simply trying to pass value from child window to parent window. Here's my code -
parent.php
<html>
<form name="testform" id="div" method=post>
<input type="text" name="testText">
<a href="javascript:void(0)" onclick=window.open("http://aiworker2.usask.ca/passgui/child.php","Ratting","toolbar=1,status=1,")>click</a>
</fo开发者_运维百科rm>
</html>
child.php
<html> <script langauge="javascript"> function post_value(){ opener.document.testForm.testText.value = "hello"; self.close(); } </script> <input type="button" value="Pass Value" onclick="post_value();"> </form> </html>
Problem is, it opens the child window but whent I press the button to pass value to parent window it does not do enything. From my firebug, I have found giving an error - Permission denied. I tried from Safari as well, still not working.
Demo can be found here -
http://aiworker2.usask.ca/passgui/parent.php
Change the name
of your form
to testForm
.
精彩评论