未为td标记定义javascript函数
我有以下代码:未为td标记定义javascript函数,javascript,html,Javascript,Html,我有以下代码: null 函数viewStack1355381490(){ var StackWindow=window.open(“关于:空白”,“工具栏=0,宽度=800,高度=400,可调整大小=yes,滚动条=yes”); StackWindow.document.write(“”); StackWindow.document.write(“”); StackWindow.document.write(“堆栈跟踪”); StackWindow.document.write(“”); S
null
函数viewStack1355381490(){
var StackWindow=window.open(“关于:空白”,“工具栏=0,宽度=800,高度=400,可调整大小=yes,滚动条=yes”);
StackWindow.document.write(“”);
StackWindow.document.write(“”);
StackWindow.document.write(“堆栈跟踪”);
StackWindow.document.write(“”);
StackWindow.document.write(“”);
StackWindow.document.write(“blabla”);
StackWindow.document.write(“”);
StackWindow.document.write(“
”;
StackWindow.document.write(“”);
}
您忘了定义应该是的堆栈窗口
var StackWindow;
工作一如下:
nullfunction视图堆栈1355381490(){
var堆栈窗口;
StackWindow=window.open(“关于:空白”、“工具栏=0、宽度=800、高度=400、可调整大小=yes、滚动条=yes”);
StackWindow.document.write(“”);
StackWindow.document.write(“”);
StackWindow.document.write(“堆栈跟踪”);
StackWindow.document.write(“”);
StackWindow.document.write(“”);
StackWindow.document.write(“blabla”);
StackWindow.document.write(“”);
StackWindow.document.write(“
”;
StackWindow.document.write(“”);
}
您不会遇到该错误。它表示“未捕获的TypeError:无法读取null的属性'document'。由于您试图在函数中读取该属性,因此函数已被定义。我得到未捕获类型错误:无法读取未定义的属性“document”,因为StackWindow未定义。我将var
添加到StackWindow
声明中,但没有帮助。控制台中仍然存在此错误VM603:1未捕获引用错误:viewStack1355381490未定义(…)
我已经尝试过,它工作正常,在该脚本和链接之间是否还有其他代码?