我有这部分代码:的Javascript返回undefined可变
for (i = 0; i <= texte.split(';')[1].split(',').length - 1; i++) {
cell = document.createElement("td");
cell.setAttribute("width", "10%");
cell.setAttribute("align", "center");
if (texte.split(';')[1].split(",")[i] != "")
cell.onclick = function() { chgnom('1',"'" + texte.split(';')[1].split(",")[i] + "'",''); };
textnode = document.createElement("span");
textnode.innerHTML = texte.split(';')[1].split(",")[i];
cell.appendChild(textnode);
row.appendChild(cell);
}
在innerHTML来texte.split(';')[1].split(",")[i]
调用返回“HELLO”,而是“不确定”的一个函数返回。有人可以帮助我吗?
谢谢
你能向我们展示一个关于http://JSFiddle.net的演示吗? – 2012-07-17 12:45:07
你的例子需要有更多的信息。如果它是未定义的,你可能会分裂一些不存在的东西。 – Fallenreaper 2012-07-17 12:47:29
什么是texte的价值?行变量decalred在哪里? – Nirmal 2012-07-17 12:48:06