|
 |
|
ขอทราบวิธีตรวจสอบว่า POPUP URL นี้เปิดอยู่หรือไม่ครับ |
|
 |
|
|
 |
 |
|
ผมจะเช็คว่า หน้าต่างนี้ ให้กำเนิด Popup ที่เป็น url นี้ไปแล้วหรือยังครับ ....
มีกฏว่า
1. หน้าต่างหลักสามารถเปิด POPUP ได้หลายตัวหลาย URL
2. POPUP ที่ทำการเปิดค้างไว้ จะจะเปิดPOPUPที่มี URL ซ้ำซ้อนกันอีกไม่ได้
ทีนี้เลยคิดว่าจะทำแบบนี้แต่ไม่รู้จะเอาโค้ดตัวไหนในการตรวจสอบดี
***ทุกครั้งที่กดจะเช็คก่อนว่า popup url ที่ระบุนี้ มีการให้กำเนิดจากหน้าต่างหลักนี้ไปแล้วหรือยัง
- ถ้าไม่มี เปิดเลยตามปกติ
- ถ้ามีการจะขึ้น alert ว่า หน้าต่างนี้เปิดอยู่ และไม่ทำการเปิดอีก
Code
<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('test.php','',650,600)">OPEN</a>
แนำนำด้วยครับ  
Tag : PHP, JavaScript

|
|
 |
 |
 |
 |
Date :
2014-03-07 01:56:45 |
By :
meannerss |
View :
676 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (JavaScript)
if(name != null)
{
name.focus();
}
else
{
// Open Popup
}
|
 |
 |
 |
 |
Date :
2014-03-08 06:54:50 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|