0

parent.php のテキスト ボックスの値をポップアップ ウィンドウ (child_page.php) に渡したいと考えています。以下は私のコードです。parent.php-

<html>
<head>
<script type="text/javascript">

var popupWindow=null;

function child_open()
{ 

popupWindow =window.open('child_page.php',"_blank","directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,width=600, height=280,top=200,left=200");

}
function parent_disable() {
if(popupWindow && !popupWindow.closed)
popupWindow.focus();
}
</script>

 <input type="text" name="myTextField" id="myTextField" required="required"/>


</head>
<body onFocus="parent_disable();" onclick="parent_disable();">
    <a href="javascript:child_open()">Click me</a>
</body>    

</html>

child_page.php

<h1>child page</h1>


<script>
    window.onunload = refreshParent;
    function refreshParent() {
        window.opener.location.reload();
    }
    var x=parent.document.getElementById('myTextField').value

    <?php echo x; ?>
</script>

<?php 

//how do I get the textbox value here.

    ?>

ググってやってみました。私はJavaスクリプトについてほとんど知らないので、これらの答えを解決策としてまとめることはできませんでした.

4

1 に答える 1