1

popup1.php

<script>
function pepz(pageURL, title,w,h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
} 
</script>

<a href="" onclick="pepz('<?php echo"popup2.php"; ?>', 'myPop1',465,410)"><?php print"Click"; ?></a></td>

popup2.php

<form action='#' method='post'>
<input type='submit'>
<form>

ポップアップのフォームで送信ボタンをクリックした後、ポップアップを閉じ、ポップアップを呼び出した親ページを更新する必要があります。

私は何が間違っているのですか?ありがとう:D

4

2 に答える 2

2

簡単な方法は、送信ボタンに次の属性を追加することです。

onClick="window.parent.location.reload();window.close()"
于 2012-09-26T02:59:09.227 に答える
0

親ページから次のようにポップアップを呼び出します。

window.open("foo.html","windowName", "width=400,height=400,scrollbars=no");

関数を使用してフォームを送信します。ウィンドウを閉じるイベントを制御し、親ページを更新します。

<form action='#' method='post' name='my_form'>
<input type="button" value="Upload"  onclick="closeSelf();"/>
</form>
<script>
  window.onunload = refreshParent;
  function refreshParent() {
    window.opener.location.reload();
  }
  function closeSelf(){
    document.forms['my_form'].submit();
    window.close();   
  }
</script>
于 2017-01-06T20:04:04.850 に答える