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

Determine checkbox selected_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:40:40
Original
865 people have browsed it

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

Related labels:
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