 |
|
ใช้การ target ไปยัง popup โดยให้เปิด popup ตอน submit form ครับ
Code (PHP)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>TEST</title>
<script type="text/javascript">
var win = null;
function newwin(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
win = window.open(mypage,myname,settings);
return false;
}
</script>
</head>
<body>
<form action="action.php" target="popup" method="post" onsubmit="newwin('about:blank','popup','500','200','auto');">
<input type="text" name="text" value="ทดสอบ" />
</form>
</body>
</html>
อีกวิธีนะครับ
จาก http://stackoverflow.com/questions/7353838/submit-form-to-popup-window
Code (JavaScript)
var myForm = document.getElementById('formID');
myForm.onsubmit = function() {
var w = window.open('about:blank','Popup_Window','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=300,left = 312,top = 234');
this.target = 'Popup_Window';
};
|
 |
 |
 |
 |
Date :
2014-03-28 23:31:00 |
By :
dreamt256 |
|
 |
 |
 |
 |
|
|
 |