11 二月 2010 @ 11:08 上午 

基本上,最近貼的有關於核取方塊的code都可以結合在一起
[js]
//全選後取消其中一個時全選方塊也取消
function check_box(obj,fld) {
var checkboxs = document.getElementsByName(fld);
var check = 0;
for (var i = 1; i < checkboxs.length; i++) {
if(checkboxs[i].checked == true) check++;
}
if(checkboxs.length != check) {
checkboxs[0].checked = ”;
}
if(checkboxs.length == (check+1)){
checkboxs[0].checked = true;
}
}
[/js]

接著加在”非全選核取方塊裡”
[html]
<input type="checkbox" name="select[]" id="select[]" onclick="check_box(this,’select[]’);" value="1"/>
[/html]

Posted By: fantasy
Last Edit: 11 二月 2010 @ 11:08 上午

EmailPermalink
Tags
Categories: 程設不歸路


 

Responses to this post » (None)

 
Post a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


 Last 50 Posts
 Back
 Back
Change Theme...
  • Users » 6
  • Posts/Pages » 131
  • Comments » 6
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

生活大小事



    No Child Pages.

程式設計



    No Child Pages.