2011-07-03 11 views

答えて

5

Owalla、

私はこの単純なjavascriptのようなものをGoogle検索から直接取得しました。jqueryでこれをもっと簡単な方法で実行できますが、sometを試してみてくださいこのようにして

var myWindow; 

function openCenteredWindow(url) { 
    var width = 400; 
    var height = 300; 
    var left = parseInt((screen.availWidth/2) - (width/2)); 
    var top = parseInt((screen.availHeight/2) - (height/2)); 
    var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top; 
    myWindow = window.open(url, "subWind", windowFeatures); 
} 
2

ここ

function PopupCenter(pageURL, title,w,h) { 
var left = (screen.width/2)-(w/2); 
var top = (screen.height/2)-(h/2); 
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left); 
} 

リンクこのスクリプトを試してみてください。http://www.nigraphic.com/blog/java-script/how-open-new-window-popup-center-screen

関連する問題