재우니의 블로그



새창 모니터 한 가운데 띄우도록 하는 스크립트


var windowWidth = 200;
var windowHeight = 200;
var windowLeft = parseInt((screen.availWidth/2) - (windowWidth/2));
var windowTop = parseInt((screen.availHeight/2) - (windowHeight/2));
var windowSize = "width=" + windowWidth + ",height=" + windowHeight + "left=" + windowLeft + ",top=" + windowTop + "screenX=" + windowLeft + ",screenY=" + windowTop;




일반적인 새창 구현하는 방법


<html>
    <head>
        <title></title>
 
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"></script>
 
        <script type="text/javascript">
            var windowSizeArray = [ "width=200,height=200",
                                    "width=300,height=400,scrollbars=yes" ];
 
            $(document).ready(function(){
                $('.newWindow').click(function (event){
 
                    var url = $(this).attr("href");
                    var windowName = "popUp";//$(this).attr("name");
                    var windowSize = windowSizeArray[$(this).attr("rel")];
 
                    window.open(url, windowName, windowSize);
 
                    event.preventDefault();
 
                });
            });
        </script>
    </head>
 
    <body>
        <a href="http://www.flashmn.com/" rel="0" class="newWindow" >click me</a>
        <a href="http://www.mnswf.com/" rel="1" class="newWindow" >click me</a>
    </body>
</html>