gpt4 book ai didi

javascript - 什么会导致 window.open 返回 "undefined"?

转载 作者:行者123 更新时间:2023-12-03 11:15:23 25 4
gpt4 key购买 nike

我的 Xul 应用程序中有以下脚本:

MyClass = function() {
this.go = function() {
try {
var scanWindow = window.open('chrome://test/content/scanWindow.xul','Scan','chrome, width=850, height=150, centerscreen');
dump("scanWindow = " + scanWindow); // console output in Xul
} catch(err) {
dump("ERROR: " + err); // console output in Xul
}
}
}

当我调用这个方法时它会打印

scanWindow = undefined

有什么可能导致这种情况的提示吗?

最佳答案

我认为您不能在要打开的第三个参数中使用空格。

错误:

var scanWindow = window.open('chrome://test/content/scanWindow.xul','Scan','**chrome, width=850, height=150, centerscreen**');

正确:

var scanWindow = window.open('chrome://test/content/scanWindow.xul','Scan','**chrome,width=850,height=150,centerscreen**');

关于javascript - 什么会导致 window.open 返回 "undefined"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4660681/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com