神秘(对我来说)“对象不支持此属性或方法”错误 - JavaScript HTML 推出
我从第 4 行的 Char 1 收到上述错误...不知道是什么抛出了它?我确信这是我看不到的简单事情......
out = out + "<b>Select Box Information</b><br><br> The name of the select box is: skeletor. A play on the word selector.<br>"
out = out + "The options for the select box are, Default Value, Option 2, Option 3, Option 4 and Option 5.<br>"
out = out + "The values for each option, from top to bottom, are: " + lucy.skeletor.option(0) + ", "
out = out + lucy.skeletor.option(1) + ", " + lucy.skeletor.option(2) + ", " + lucy.skeletor.option(3)
out = out + ", " + lucy.skeletor.option(4) + ".<br><br>"
out = out + "The index of the first option in the select box is: 0. The location of the user-selected option is: " + lucy.skeletor.value + ".<br><br>"
I'm getting the error above from Char 1 of the 4th line... No clue what's throwing it? I'm sure its something simple that I don't see...
out = out + "<b>Select Box Information</b><br><br> The name of the select box is: skeletor. A play on the word selector.<br>"
out = out + "The options for the select box are, Default Value, Option 2, Option 3, Option 4 and Option 5.<br>"
out = out + "The values for each option, from top to bottom, are: " + lucy.skeletor.option(0) + ", "
out = out + lucy.skeletor.option(1) + ", " + lucy.skeletor.option(2) + ", " + lucy.skeletor.option(3)
out = out + ", " + lucy.skeletor.option(4) + ".<br><br>"
out = out + "The index of the first option in the select box is: 0. The location of the user-selected option is: " + lucy.skeletor.value + ".<br><br>"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为
lucy.skeletor.option(1)
将是这里的问题。如果lucy.skeletor
是一个真正的select
元素,它包含一个options
数组。该数组可以像这样引用:lucy.skeletor.options[n]
此外,如果您连接,您可以这样做:
I'd think
lucy.skeletor.option(1)
will be the problem here. Iflucy.skeletor
is a genuineselect
element, it contains anoptions
array. That array can be referenced like:lucy.skeletor.options[n]
furthermore, if you concatenate, you could do:
out = out + ... 可以,只是没有必要。
您的问题是使用 .option(1) 访问不存在的集合
如果 skeletor 是 a 那么较新浏览器的正确语法是
lucy.options[1].value 或 .text
这就是我认为您的意思
out = out + ... is ok, just not necessary.
Your problem is using .option(1) which is accessessing a non-existing collection
If skeletor is a then the correct syntax for newer browsers is
lucy.options[1].value or .text
Here is what I think you meant