我已阅读这篇文章Need helping with innerHTML and array input variables。但是当我这样做时:
if (errors.length > 0) {
var htmlErrors ='';
for (var i = 0; i < errors.length; i++) {
htmlErrors += errors[i];
}
document.getElementById("registration_errors").innerHtml = htmlErrors;
我得到白屏。我的错误在哪里?
答案 0 :(得分:3)
尝试:innerHTML
Link
document.getElementById("registration_errors").innerHTML = htmlErrors;
答案 1 :(得分:1)
if未关闭,而innerHTML
代替innerHtml
:
if (errors.length > 0) {
var htmlErrors ='';
for (var i = 0; i < errors.length; i++) {
htmlErrors += errors[i];
}
document.getElementById("registration_errors").innerHTML = htmlErrors;
}