<div class="jb51code"> <pre class="brush:js;"> var items = document.getElementsByName("spec_spec_1[]"); alert(items.length); for (i = 0; i < items.length; i++) { if(items[i].value==''){ alert('名称不能为空'); } }</pre> </div>