锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲综合一区二区精品导航
,久久亚洲精品11p,国产.亚洲.欧洲在线http://m.tkk7.com/TiGERTiAN/category/2177.html----TiGERTiANzh-cnFri, 13 Nov 2009 07:18:41 GMTFri, 13 Nov 2009 07:18:41 GMT60鐢╦Query緇欓〉闈腑鏍?wèi)迮炵殑Checkbox榛樿鍔犱笂鐖跺瓙鑺傜偣鐩稿叧鎿嶄綔(JSF鐨凴ichfaces涓撶敤)http://m.tkk7.com/TiGERTiAN/archive/2009/11/12/302043.htmlTiGERTiANTiGERTiANThu, 12 Nov 2009 00:46:00 GMThttp://m.tkk7.com/TiGERTiAN/archive/2009/11/12/302043.htmlhttp://m.tkk7.com/TiGERTiAN/comments/302043.htmlhttp://m.tkk7.com/TiGERTiAN/archive/2009/11/12/302043.html#Feedback4http://m.tkk7.com/TiGERTiAN/comments/commentRss/302043.htmlhttp://m.tkk7.com/TiGERTiAN/services/trackbacks/302043.htmljQuery.noConflict();//涓嶫SF鎼厤闇瑕佽繖鍙ヨ瘽錛屼笉鐒朵細(xì)鏈夊啿紿?/span> jQuery(document).ready(function() { // Add click event listener to each checkbox in the tree page // Note! Using this simple selector assumes that there are no other // checkboxes on the page, if there are other checkboxes then // selector should be changed jQuery(":checkbox").click(function(){ updateChildren(this); updateParent(this); }); }); </script> <script type="text/javascript"> function updateChildren(currentCheckBox) { // Get state of current checkbox (true or false) var state = currentCheckBox.checked; // Get parent TABLE, where current checkbox is places var parentTables = jQuery(currentCheckBox).parents("table"); var parentTable = parentTables[0]; // Get DIV where child nodes with checkboxes are situated // See http://docs.jquery.com/Traversing/ to get better uderstanding of // parents() and next() var childDivs = jQuery(parentTable).next("div"); if( childDivs.length >0 ) { var childDiv = childDivs[0]; // Iterate over all child nodes checkboxes and set same state as the // current checkbox state jQuery(childDiv).contents().find(":checkbox").each(function() { this.checked = state; }); } } //鏇存柊鐖惰妭鐐圭殑鏂規(guī)硶錛屽鏋滃瓙鑺傜偣鍏ㄩ儴閫変腑鍒欑埗鑺傜偣閫変腑錛屽鏋滃瓙鑺傜偣涓湁涓涓湭閫変腑錛屽垯鐖惰妭鐐逛篃鏈変腑 function updateParent(currentCheckbox) { var parentDivs = jQuery(currentCheckbox).parents("div"); var parentDiv = parentDivs[0]; var hasSelected =false; jQuery(parentDiv).contents().find(":checkbox").each(function() { if(this.checked) { hasSelected =true; }else{ hasSelected = false;
return;
} }); var parentTables = jQuery(parentDiv).prev("table"); if(parentTables.length >0) { var parentTable = parentTables[0]; var parentCheckboxes = jQuery(parentTable).find(":checkbox"); var parentCheckbox = parentCheckboxes[0]; parentCheckbox.checked = hasSelected ; } }
娉ㄦ剰寮曞叆jQuery鍖呫?br />
姝s浠g爜鍔犲埌欏甸潰涓紝灝嗕細(xì)緇欓〉闈腑鐨勬爲(wèi)褰㈣彍鍗曠殑Checkbox榛樿鍔犱笂涓浜涘姛鑳斤細(xì)褰撻夋嫨鐖惰妭鐐規(guī)椂鍏ㄩ夊瓙鑺傜偣錛涘綋瀛愯妭鐐瑰叏閫夋椂錛岀埗鑺傜偣涔熶細(xì)琚嚜鍔ㄩ夋嫨涓娿傚悓鏃朵笉浼?xì)濯?jiǎng)鍝嶅叾浠朇heckbox銆?