Home  >  Article  >  Web Front-end  >  Collection of methods to determine whether a radio button or check box is selected in javascript_Form special effects

Collection of methods to determine whether a radio button or check box is selected in javascript_Form special effects

WBOY
WBOYOriginal
2016-05-16 19:15:521050browse

Tip: The getElementsByName method is used to obtain a collection of objects based on the value of the NAME tag attribute.
Sample 1



Determine whether the radio button or check box is selected
















Tip: The getEmentsByName method works based on the value of the NAME tag attribute Gets a collection of objects.


Sample 2:







<script>... <BR>function check()...{ <BR> var flag=0 <BR> for(i=0;i<myform.picno.length;i++) <BR> if(myform.picno[i].checked==true)...{ <BR> flag=1 <BR> break <BR> } <BR> if(!flag)...{ <BR> alert("请先选择更换图片的位置") <BR> return false <BR> } <BR>} <BR></script>
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