here is part of my function code that makes an error on javascript error console ( Google Chrome)
这是我的功能代码的一部分,在javascript错误控制台(谷歌浏览器)上出错
function premuto(x){
if(x.Clickable){
x.Selected = !x.Selected;
if (x.Selected){
x.style.backgroundColor ='lightblue';
y = document.getElementById('spazio');
y.innerHTML = y.innerHTML + x.innerHTML;
sequenza[indice] = x.Number;
indice++;
}
error compares at line "sequenza[indice] = x.Number;"
错误比较在行“sequenza [indice] = x.Number;”
What's wrong?
Thanks
1 个解决方案
#1
2
Your indice
is 0 and sequenza
is undefined
. In javascript it always raises a type error, if you try to reach undefined variable's properties or methods. You should debug your code and see exactly when sequanza becomes undefined
.
你的indice是0并且sequenza是未定义的。在javascript中,如果您尝试访问未定义变量的属性或方法,它总是会引发类型错误。您应该调试代码并准确查看sequanza何时变为未定义。
#1
2
Your indice
is 0 and sequenza
is undefined
. In javascript it always raises a type error, if you try to reach undefined variable's properties or methods. You should debug your code and see exactly when sequanza becomes undefined
.
你的indice是0并且sequenza是未定义的。在javascript中,如果您尝试访问未定义变量的属性或方法,它总是会引发类型错误。您应该调试代码并准确查看sequanza何时变为未定义。