javascript运行时错误。 [英] javascript runtime error.
问题描述
strBuilder.Append(window.opener.document.deductInstruction_form.AUTH_ERP_UI_AUTHORIZATION_DETAIL_ID.value ='';&vbCrLf)
strBuilder.Append(window.opener.document.forms [0] .AUTH_ERP_UI_AUTHORIZATION_DETAIL_ID.value ='';&vbCrLf)
上面有什么区别2个陈述。
因为'
window.opener.document.deductInstruction_form.AUTH_ERP_UI_ ...我收到错误
未定义或空参考
但是对于
.document.forms [0] .AUTH_ERP_UI_AUTHORIZATI
它没有给出javascript运行时错误。
strBuilder.Append("window.opener.document.deductInstruction_form.AUTH_ERP_UI_AUTHORIZATION_DETAIL_ID.value='';" & vbCrLf)
strBuilder.Append("window.opener.document.forms[0].AUTH_ERP_UI_AUTHORIZATION_DETAIL_ID.value='';" & vbCrLf)
what is the difference between above 2 statements.
because for'
window.opener.document.deductInstruction_form.AUTH_ERP_UI_ ... I get error
Undefined or null refernce
but for
.document.forms[0].AUTH_ERP_UI_AUTHORIZATI
It does not give javascript runtime error.
推荐答案
第一个语句有121个字符,但第二个只有107个字符。我告诉你它有助于你理解它关于差异的问题通常是不正确的。 :-)
显然,对象window.opener.document
没有属性deductInstruction_form
。您认为为什么会这样?
您真的需要了解HTML DOM的工作原理以及Javascript对象的工作原理。这些对象的行为类似于关联容器,您可以通过某些索引访问属性。通过索引0,找到了某种形式,但您从未按索引deductInstruction_form
存储任何内容。是的,属性名称和索引是相同的东西,它们只是字符串键。请参阅:
http://en.wikipedia.org/wiki/Javascript#Dynamic [ ^ ]。
-SA
First statement has 121 characters, but the second one only 107. I am telling you about it to help you to understand that the questions about the "difference" are usually incorrect. :-)
Apparently, the objectwindow.opener.document
does not have the propertydeductInstruction_form
. Why do you think it would?
You really need to learn how HTML DOM work and how Javascript objects work. Those objects behave like associative containers where you can access properties by some indices. By index 0, some form is found, but you never stored anything by indexdeductInstruction_form
. Yes, property names and indices are the same things, they are just the string keys. Please see:
http://en.wikipedia.org/wiki/Javascript#Dynamic[^].
—SA
这篇关于javascript运行时错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!