给你一个简单的问题,但对我来说仍然很难... 所有我想做的,是最大化新的,打开窗口与不同的按钮......但它不起作用,无法弄清楚为什么..有人可以请告诉我,我做错了什么?
<form>
<input type="button" value="Create New Window" onclick="createWindow()" />
<input type="button" value="Maximize New Window" onclick="maximizeWindow()" />
</form>
var maxWindow;
function createWindow(){
var winWidth = 300;
var winHeight = 100;
var winLeft = (screen.width - winWidth)/2;
var winTop = (screen.height - winHeight)/2;
var winOptions = ",width=" + winWidth + ",height=" + winHeight + ",left=" + winLeft + ",top=" + winTop;
maxWindow = window.open("http://www.google.com","newWindow",winOptions);
maxWindow.focus();
}
function maximizeWindow() {
maxWindow.moveTo(0,0);
maxWindow.resizeTo(screen.availWidth, screen.availHeight);
maxWindow.focus();
}
答案 0 :(得分:1)
<script>
var maxWindow;
function createWindow(){
var winWidth = 300;
var winHeight = 100;
var winLeft = (screen.width - winWidth)/2;
var winTop = (screen.height - winHeight)/2;
var winOptions = ",width=" + winWidth + ",height=" + winHeight + ",left=" + winLeft + ",top=" + winTop+'fullscreen=yes';
maxWindow = window.open("http://www.google.com","newWindow",winOptions);
maxWindow.focus();
}
function maximizeWindow() {
maxWindow.moveTo(0,0);
maxWindow.resizeTo(screen.width, screen.height);
maxWindow.focus();
}
</script>
<form>
<input type="button" value="Create New Window" onclick="createWindow()" />
<input type="button" value="Maximize New Window" onclick="maximizeWindow()" />
</form>
我将此添加到第一个函数'fullscreen = yes',在第二个函数中将第二行添加到我的代码maxWindow.resizeTo(screen.width,screen.height);