|
 |
|
ถามเรื่องเปิดหน้าต่าง pop up เพื่อใส่ข้อมูล แล้ว popup ปิด พร้อมกับ refres หน้าหลักค่ะ |
|
 |
|
|
 |
 |
|
ตอนนี้มันรีเฟรชหน้าหลักแล้วค่ะ แต่ pop up มันไม่ปิดอัตโนมัติ อะค่ะ
หน้าหลัก
<script type="text/javascript">
function popup(url,name,windowWidth,windowHeight){
myleft=(screen.width)?(screen.width-windowWidth)/2:100;
mytop=(screen.height)?(screen.height-windowHeight)/2:100;
properties = "width="+windowWidth+",height="+windowHeight;
properties +=",scrollbars=yes, top="+mytop+",left="+myleft;
window.open(url,name,properties);
}
</script>
<a href="javascript:popup('formlogin.php','',380,180)" class="linkmember">Login</a>
หน้า pop up
<script language="JavaScript">
<!--
function closewin() {
window.opener.location.reload();
window.opener.form1.button.value="refresh ready";
self.close();
}
</script>
if((!empty($user)) and (!empty($password)))
{
$sql = "select * from register where username='$user' and password='$password'"; //เช็คค่าข้อมูลที่ส่งมาจากฟอร์ม
$result=mysql_query($sql) or die(mysql_error());
$num_rows = mysql_num_rows($result);
if($num_rows==1){
session_register ( "user" );
session_register ( "password" );
echo PHPalert('Username และ Password ถูกต้อง ระบบกำลังนำท่านเข้าสู่เว็บไซค์');
echo "<div align=\"center\"><input type=\"button\" value=\"Close\" onclick=\"closewin();\"></div>";
//header("location:index.php");
}else{
echo "<script language='javascript'>
alert('Username และ Password ไม่ถูกต้อง กรุณา Login ใหม่อีกครั้ง');
window.location='index.php';</script>";
echo "<script>window.close();</script>";
}
}
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2010-04-21 10:35:19 |
By :
yam |
View :
1752 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
"<script>alert('มีข้อผิดพลาด !!!');window.opener.close();window.close();</script>";
ลองเอาไปทดสอบนะครับ...
|
 |
 |
 |
 |
Date :
2010-04-22 09:37:53 |
By :
pukmtec |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|