SMF & Programmer > Programmer

แสดง popup window ตรงกลาง

(1/1)

Admin:
Javascript 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> 
--- End code ---

HTML code


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

นำร่อง

[0] ดัชนีข้อความ

Go to full version