Home >Web Front-end >JS Tutorial >js uses for loops and if statements to determine multiple identical name_javascript techniques

js uses for loops and if statements to determine multiple identical name_javascript techniques

WBOY
WBOYOriginal
2016-05-16 16:36:331178browse
var items = document.getElementsByName("spec_spec_1[]");
alert(items.length);
for (i = 0; i < items.length; i++) {
if(items[i].value==''){
alert('名称不能为空');
}
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn