อ่าน Naruto 700 แปลไทย, อ่าน One Piece 782 แปลไทย, อ่าน Bleach 622 แปลไทย, อัพเดทข่าวประจำวันและข่าวไอที โหลดเพลง โหลดโปรแกรม คำคมโดนๆ

SMF & Programmer => Programmer => ข้อความที่เริ่มโดย: Admin ที่ กรกฎาคม 01, 2012, 07:54:43 pm

หัวข้อ: แสดง popup window ตรงกลาง
เริ่มหัวข้อโดย: Admin ที่ กรกฎาคม 01, 2012, 07:54:43 pm
Javascript code


โค๊ด: [Select]
<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> 

HTML code

โค๊ด: [Select]
<a href="javascript:popup('http://www.google.com','',400,400)" >เปิด google.com แบบ popup </a>