JSP radio button verification, drop-down box validation, check box verification to implement code _JSP programming

Source: Internet
Author: User
Verify Sex (radio button validation)
function Checkxb () {
var temp = false;
var xbobj1= document.getelementbyid ("Xb1");
var xbobj2= document.getelementbyid ("Xb2");
if (xbobj1.checked | | xbobj2.checked) {
temp = true;
}
return temp;
}
function Checkform () {
Verify Sex (radio button validation)
if (!CHECKXB ()) {
Alert ("Please select Gender");
return false;
}
Certification staff category (dropdown box validation)
if (document.getElementById ("lb"). SelectedIndex = = 0) {
Alert ("Please select person category");
return false;
}
}
(check box validation) to determine whether at least one checkbox is selected.
function Checkselectedone (cbxname) {
var Cbxs = Document.getelementsbyname (cbxname);
if (Cbxs!= null) {
if (cbxs.length) {
for (var i=0; i<cbxs.length; i++) {
if (cbxs[i].checked) {
return true;
}
}
}else{
Return cbxs.checked
}
}
return false;
}
if (!checkselectedone (' Xgjzh ')) {
Alert ("You have no choice!") ");
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.