日期:2014-05-16  浏览次数:20379 次

如图,我想让每个名字占一行该怎么做


在前端我已经获取了每个名字,但却无法将它显示出来
              var innerdetail = unescape(xmlhttp.responseText),
                                  txt = innerdetail.split(",");
                                for (i = 0; i < txt.length; i++) {
                                    var opt = new Option();
                                    opt.value = txt[i];
                                    opt.text = txt[i];
                                    var selobject = document.getElementById("keytishi");
                                    selobject.innerHTML"<lu><li>"+txt[i]+"</li></lu><br/>";                                }
要怎么修改呢

------解决方案--------------------

var txt = "aaaa,bbbb,cccc,dddd".split(",");
var html = "";
for (i = 0; i < txt.length; i++) {
html += "<li>" + txt[i] + "</li>";
}
var selobject = document.getElementById("keytishi");
selobject.innerHTML = "<ul>" + html + "</ul>";
selobject.style.display = "block";