JavaScript Radio and check button codes

Source: Internet
Author: User
His radio is this: <input name= ' del_id ' type= ' checkbox ' id= ' del_id ' value= ' "&rs (0) &" ' title= ' Select/Do not choose ' onclick= ' "Web effects: CCA (this); "" >
Select all: <input type= ' checkbox ' name= ' del_all ' id= ' del_all ' ' value= ' 1 ' onclick= ' "Javascript:selectall ('" &cstr (i) & "'); JAVASCRIPT:CA ();" "Title= ' Select/Uncheck all locations on this page ' >

Select all background color
function CA () {
var value = form1.del_all.checked? ' H ': ';
if (form1.del_id.length) {
for (Var i=0;i<form1.del_id.length;i++) {
form1.del_id[i].checked=form1.del_all.checked;
Form1.del_id[i].parentnode.parentnode.classname = value;
}
}
else{
if (form1.del_id) {
form1.del_id.checked=form1.del_all.checked;
Form1.del_id.parentnode.parentnode.classname = value;

}
}
}
Single-selection background discoloration
function CCA (CB) {
if (cb.checked) {
Cb.parentnode.parentnode.classname= ' h ';
}
else{
Cb.parentnode.parentnode.classname= ';
}
}
-->
</script>
<style>
tr.h {background-color: #fdfddf}
TR.J {background-color: #f61842}
</style>
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.