 |
|
popup1.html
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
<script language="JavaScript">
function fncOpenPopup()
{
window.open('popup2.html','popup-name','width=700,height=500,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0');
}
</script>
</head>
<body>
<form name="frmMain" action="" method="post">
<input type="text" name="txtName" value="">
<input type="button" name="btnOpen" value="OpenPopup" OnClick="fncOpenPopup();">
</form>
</body>
</html>
popup2.html
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
<script language="">
var limit="0:10"
if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function begintimer(){
if (!document.images)
return
if (parselimit==1)
// เหตุการณ์ที่ต้องการให้เกิดขึ้น
// window.location='page.php'; ถ้าต้องการให้กระโดดไปยัง Page อื่น
//frmMain.submit();
self.opener.document.frmMain.txtName.value = '1234';
window.close();
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime="เวลาที่เหลือ <font color=red> "+curmin+" </font>นาที กับ <font color=red>"+cursec+" </font>วินาที "
else
if(cursec==0)
{
alert('หมดเวลาแล้วจ้า');
}
else
{
curtime="เวลาที่เหลือ <font color=red>"+cursec+" </font>วินาที "
}
document.getElementById('dplay').innerHTML = curtime;
setTimeout("begintimer()",1000)
}
}
//-->
</script>
</head>
<body onLoad="begintimer()">
<form name="frmMain" action="" method="post">
<center>
<h1>Welcome to ThaiCreate.Com</h1>
<input type="button" name="btnClose" value="Close" OnClick="window.close();">
</center>
<div id=dplay ></div>
</form>
</body>
</html>
|
 |
 |
 |
 |
Date :
2011-05-01 08:23:50 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |