Home  >  Article  >  Web Front-end  >  Determine checkbox selected_html/css_WEB-ITnose

Determine checkbox selected_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:40:40832browse

The source code is as follows, for reference only, just copy it directly:


<script><br>function checkbox()<br>{<br>var str=document.getElementsByName("box");<br>var objarray=str.length;<br>var chestr="";<br>for (i=0;i<objarray;i )<br />{<br /> if(str[i].checked == true)<br /> {<br /> chestr = str[i].value ",";<br /> }<br />}<br />if(chestr == "")<br />{<br /> alert("Please choose a hobby first~!");<br />}<br />else<br />{<br /> alert("Your first choice is:" chestr);<br />}<br />}<br /></script>
Select your hobbies :
Diving
Running
Listen to music

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