Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未捕获类型错误:无法读取属性';IStagingAreapub';未定义的_Javascript - Fatal编程技术网

Javascript 未捕获类型错误:无法读取属性';IStagingAreapub';未定义的

Javascript 未捕获类型错误:无法读取属性';IStagingAreapub';未定义的,javascript,Javascript,有关以下代码: document.getElementById ("ifrmWorkarea").contentWindow.document.all.hiddenfields.isStagingAreaPub.value == "Y") 我得到: 未捕获的TypeError:无法读取的属性“isStagingAreaPub” 在chrome浏览器中未定义 调用html: <form name="hiddenfields"> <input type=hidden

有关以下代码:

 document.getElementById ("ifrmWorkarea").contentWindow.document.all.hiddenfields.isStagingAreaPub.value == "Y")
我得到:

未捕获的TypeError:无法读取的属性“isStagingAreaPub” 在chrome浏览器中未定义

调用html:

<form  name="hiddenfields">
    <input type=hidden  name="isStagingAreaPub" value="<%= isStagingPub %>">    
</form>

请建议如何解决此问题。

这意味着

document.getElementById ("ifrmWorkarea").contentWindow.document.all.hiddenfields
甚至不存在。因此,您无法从中检索该属性,因为您的选择器写入错误

要了解控制台中选择器的哪个部分有缺陷,请编写:

document.getElementById ("ifrmWorkarea").contentWindow
若那个并没有返回未定义,那个么在控制台中写入

document.getElementById ("ifrmWorkarea").contentWindow.document
document.getElementById ("ifrmWorkarea").contentWindow.document.all
若并没有返回未定义,那个么在控制台中写入

document.getElementById ("ifrmWorkarea").contentWindow.document
document.getElementById ("ifrmWorkarea").contentWindow.document.all

调用html:var isStagingAreaPub='Y';document.getElementById(“ifrmWorkarea”).contentWindow.document.form.getElementById(“isStagingAreaPub”)。值==“Y”不管这是否引发了相同的错误,选择器中的某个对象正在选择未定义的对象。然后,您现在选择了一个存在但为null的对象,并尝试读取该对象的属性,该属性由于为null而不可能。