Js obtains the background field and changes the selected status of the checkbox. Code _ javascript tips-js tutorial

Source: Internet
Author: User
Js obtains the background field and changes the selected status code of the checkbox. For more information, see. The Code is as follows:


Is it a package person?



Is it the total contractor?



Zbr = ("Y". equals (String. valueOf (map. get ("ylzd11 "))))? "1": "0"; // whether it is the total contractor

Fbr = ("Y". equals (String. valueOf (map. get ("ylzd12 "))))? "1": "0"; // whether it is a package
Return "jzysuccess ";

Function init (){

// Common invoice payer type code 1 stands for the unit 0 stands for the individual

If ($ ("# fkfLxDm"). val () = '1 '){
$ ('Input [type = radio] [value = 1] ') [0]. checked = true;
} Else if ($ ("# fkfLxDm"). val () = '0 '){
$ ('Input [type = radio] [value = 0] ') [0]. checked = true;
}

// Whether the unified invoice for the construction industry is the total contractor
If ($ ("# zbr"). val () = '1 '){
//The id of the zbr package owner must be accurate and unique.
$ ("# Zbr1") [0]. value = true;
Alert ($ ("# zbr"). val ());
$ ('Input [type = checkbox] [value = true] ') [0]. checked = true;
Alert ($ ("# fbr"). val ());
} Else {
$ ("# Zbr") [0]. value = false;
$ ('Input [type = checkbox] [value = false] ') [0]. checked = false;
}
// Whether the unified invoice for the construction industry is the package owner
Alert ($ ("# fbr"). val ());
If ($ ("# fbr"). val () = '1 '){
//The fbr package id must be accurate and unique.
$ ("# Fbr1") [0]. value = true;
$ ('Input [type = checkbox] [value = true] ') [1]. checked = true;

} Else {
$ ("# Fbr") [0]. value = false;
$ ('Input [type = checkbox] [value = false] ') [1]. checked = false;
}
}

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.