嗨,如何使用 javascriptscript 打开一个新窗口,然后关闭当前窗口..
目前,我只能打开一个新窗口,但我当前的窗口仍然保持打开状态。
代码:
function newfunction()
{
window.open("index.html", "myWindow", "status = 1, height = 300, width = 300, resizable = 0");
}
最佳答案
打开一个新窗口并关闭旧窗口对我来说听起来非常像更改当前页面。使用location.href = 'newurl'
。
如果你想改变它的大小等,也可以做到。
window.innerWidth = 300;
window.innerHeight = 300;
location.href = 'newurl';
关于javascript - 在 JavaScript 中打开新窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4385354/