Home > Web Front-end > JS Tutorial > 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
Release: 2016-05-16 19:15:52
Original
1110 people have browsed it

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>
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template