javascript 單選及複選按鈕代碼

來源:互聯網
上載者:User
他的單選是這樣:<input name='del_id' type='checkbox' id='del_id' value='"&rs(0)&"' title='選擇/不選' onclick=""網頁特效:cca(this);"">
全選是這樣:<input type='checkbox' name='del_all' id='del_all' value='1' onclick=""javascript:selectall('"&cstr(i)&"');javascript:ca();"" title='選中/取消選中 本頁所有外景地'>

 
//全選背景變色
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;
            
      }
   }
}
//單選背景變色
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>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.