如果之前已经问过这个问题,我很抱歉,
我对我的代码很好奇:
function showPopup(file,wdth,hght) {
//height = 768 width = 1024
var w = wdth;
var h = hght;
var winWidth = w+'px';
var winHeight = h+'px';
var winTop = (screen.height/2)-(h/2);
var winLeft = (screen.width/2)-(w/2);
window.open(file,'Upload','top='+winTop+',left='+winLeft+',width='+winWidth+',height='+winHeight+',toolbar=1,resizeable=1,statusbar=1,scrollbar=1,location=1, fullscreen=1');
}
然后我用HTML运行它:
<input type="button" onClick="showPopup('preview.php', '1000', '1000')" value="Priview">
当我在我的功能中设置时,打开的窗口仍然没有工具栏,状态栏,滚动条等。
有人帮我解决了我的代码有什么问题吗? THX
答案 0 :(得分:1)
<html>
<head>
<title>Test Website</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
function showPopup(file,wdth,hght) {
//height = 768 width = 1024
var w = wdth;
var h = hght;
var winWidth = w;
var winHeight = h;
var winTop = (screen.height/2)-(h/2);
var winLeft = (screen.width/2)-(w/2);
window.open(file,'Upload','top='+winTop+',left='+winLeft+',width='+winWidth+',height='+winHeight+',toolbar=1,resizeable=1,statusbar=1,scrollbar=1,location=1, fullscreen=1');
}
</script>
</head>
<body>
<input type="button" onClick="showPopup('preview.php', '500', '500')" value="Priview">
</body>
</html>
答案 1 :(得分:0)
第二个参数('name')是'Upload' - 它应该是'_blank'
或此处提到的其他支持值之一:http://www.w3schools.com/jsref/met_win_open.asp
Paul Calabro也是对的,你不需要“px”单位。