js调用报错,找不到原因,求大神
functiondisableInput(data){//对表单中所有的input进行遍历vararrayObj=newArray();varlist=document....
function disableInput(data) {
//对表单中所有的input进行遍历
var arrayObj = new Array();
var list = document.getElementsByTagName("input");
for (var i = 0; i < list.length && list[i]; i++) {
//判断是否为文本框
if (list[i].type == "submit") {
list[i].style.display = "none";
} else if (list[i].type == "text") {
arrayObj.push(list[i]);
list[i].style.display = "";
list[i].disabled = "disabled";
}
}
var array = data.split("|");
for (var j = 0; j < array.length; j++) {
var tmp = array[j].split("^");
var tmp0 = tmp[0];
arrayObj[tmp0 - 1].value = tmp0 + " " + tmp[1];
}
}
报错信息:[INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected identifier", source: (1)
传入的data值为:1^spent|2^can't help|3^everything|4^such a|5^shared with|6^as well as|7^opportunity|8^hometown|9^convenient for|10^help 展开
//对表单中所有的input进行遍历
var arrayObj = new Array();
var list = document.getElementsByTagName("input");
for (var i = 0; i < list.length && list[i]; i++) {
//判断是否为文本框
if (list[i].type == "submit") {
list[i].style.display = "none";
} else if (list[i].type == "text") {
arrayObj.push(list[i]);
list[i].style.display = "";
list[i].disabled = "disabled";
}
}
var array = data.split("|");
for (var j = 0; j < array.length; j++) {
var tmp = array[j].split("^");
var tmp0 = tmp[0];
arrayObj[tmp0 - 1].value = tmp0 + " " + tmp[1];
}
}
报错信息:[INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected identifier", source: (1)
传入的data值为:1^spent|2^can't help|3^everything|4^such a|5^shared with|6^as well as|7^opportunity|8^hometown|9^convenient for|10^help 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询