วันศุกร์ที่ 17 ธันวาคม พ.ศ. 2553

popup windows close and refresh opener window

test.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>test</title>
</head>

<body>

<div><?php echo date('H:i:s');?></div>

<button onclick="var w=window.open('popup.php','popup_name','width=850,height=300');w.focus();">Open Popup</button>

</body>
</html>


popup.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>pop up</title>
</head>

<body>

<?php if (!empty($_POST['test'])) echo "name={$_POST['test']}";?>

<form method="post">

<input type="text" name="test" />
<input type="submit"/>
</form>

<button onclick="opener.location=opener.location.toString();self.close();">Close</button>

</body>
</html>

ไม่มีความคิดเห็น:

แสดงความคิดเห็น