次のような動的変数があります。
var oneButton= null;
var oneMoreButton= null;
var differentNameButton= null;
var anotherButtonDifferent= null;
それから私はこれを持っています:
switch(valor){
case 0:data = "oneButton"; break;
case 1:data = "oneMoreButton";break;
case 2:data = "differentNameButton";break;
case 3:data = "anotherButtonDifferent";break;
}
それから最後に私はこれを持っています:
switch(anotherValor){
case 1:eval(data + ' = ' + document.getElementById('oneNameDiv').parentNode);break;
case 2:eval(data + ' = ' + document.getElementById('anotherDivName').parentNode);break;
case 3:eval(data + ' = ' + document.getElementById('oneMoreDivWithDifferentName').parentNode);break;
case 4:eval(data + ' = ' + document.getElementById('hereIsAnotherDivName').parentNode);break;
}
実行しようとすると、Firefox コンソールにエラーが表示されます。
missing ] after element list
http://localhost:8090/myapplication/functions.js
test1 = [objectHTMLDivElement]
誰かが何が起こっているか知っていますか?