posted by 준치 2013. 8. 29. 17:42

은근 자주 사용하는 자바스크립트...

팝업을 띄우는데 화면 가운데 띄우고 싶다.. 이럴때 사용한다..

var uri = '팝업창 url'
    var width = 520;
    var height = 500;
    var top = (screen.availHeight - height) / 2;
    var left = (screen.availWidth - width) / 2;

    var strFeature;
    strFeature = 'height=' + height + ',width=' + width + ',menubar=no,toolbar=no,location=no,resizable=no,status=no,scrollbars=yes,top=' + top + ',left=' + left

window.open(uri, 'DocAttach', strFeature);

함수로 만들어 쓰면 간단하다.

오늘도 화이팅~~