読み出し値はcheckboxが足りるかどうかおよび全選択(メモ)が必要かどうかを判断する


 <html>                                                                  
 <head>                                                                  
 <script type="text/javascript" src="jquery-1.4.4.min.js"></script>          
 <script type="text/javascript">    
	$(function(){
		var str = "2,5,c";
		checked(str);
	});

	function checked(str){
		if(str.indexOf(",")==-1){
			checkValues(str);
			return;
		}
		
		var values = str.split(",");
		//    
		$.each(values,function(n,value){
			//alert(n+", "+value);
			checkValues(value);
		});
	
	}

	function checkValues(value){
		$("input:checkbox[name='pageAdapterEntity.groupIds']").each(function(){
			//$(this).attr("checked",true);
			//alert($(this).val());
				if($(this).val()==value){
					$(this).attr("checked",true);
				}
			});
	}

	//  ,  
	function checkAll(t){
		$("input:checkbox").each(function(){
			$(this).attr("checked",t.checked);
		});
	}
   // we will add our javascript code here                                     
 </script>                                                               
 </head>                                                                 
 <body>                                                                  
   <!-- we will add our HTML content here -->      
   <table>
		<tr><td><input type="checkbox" name="pageAdapterEntity.groupIds" value="1"/>1</td></tr>
		<tr><td><input type="checkbox" name="pageAdapterEntity.groupIds" value="2"/>2</td></tr>
		<tr><td><input type="checkbox" name="pageAdapterEntity.groupIds" value="3"/>3</td></tr>
		<tr><td><input type="checkbox" name="pageAdapterEntity.groupIds" value="4"/>4</td></tr>
		<tr><td><input type="checkbox" name="pageAdapterEntity.groupIds" value="5"/>5</td></tr>
		<tr><td><input type="checkbox" name="pageAdapterEntity.groupIds" value="6"/>6</td></tr>
   <table/>

    <table>
		<tr><td><input type="checkbox" name="pageAdapterEntity.uaids" value="a"/>a</td></tr>
		<tr><td><input type="checkbox" name="pageAdapterEntity.uaids" value="b"/>b</td></tr>
		<tr><td><input type="checkbox" name="pageAdapterEntity.uaids" value="c"/>c</td></tr>
		<tr><td><input type="checkbox" name="pageAdapterEntity.uaids" value="d"/>d</td></tr>
		<tr><td><input type="checkbox" name="pageAdapterEntity.uaids" value="e"/>e</td></tr>
		<tr><td><input type="checkbox" name="pageAdapterEntity.uaids" value="f"/>f</td></tr>
   <table/>
	checkall<input type="checkbox" name="checkall"  onclick="checkAll(this)"/>
 </body>                                                                 
 </html>