<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.js"></script>
<script type="text/javascript">
function checked_all( id, nameclass ){
$("input[class^=" + nameclass + "]").attr('checked', $('#' + id).is(':checked'));
}
</script>
</head>
<body>
<p>ALL
<input type="checkbox" name="checked_all" id="checked_all" onClick="checked_all( this.id, 'check_me' )" />
</p>
<p>
<input type="checkbox" name="checkbox" id="checkbox" class="check_me" />
1
</p>
<p>
<input type="checkbox" name="checkbox2" id="checkbox2" class="check_me" />
2
</p>
<p>
<input type="checkbox" name="checkbox3" id="checkbox3" class="check_me" />
3
</p>
<p>
<input type="checkbox" name="checkbox4" id="checkbox4" class="check_me" />
4
</p>
</body>
</html>
ไม่มีความคิดเห็น:
แสดงความคิดเห็น