<script language="javascript">
function chkAll(num)
{
for(i=0 ; i<num ; i++) {
document.form1.???.checked = 'checked' ;
}
}
</script>
<? $total = 15 ; ?>
<form id="form1" name="form1" method="post" action="">
<input type="checkbox" name="a" value="" onclick="
if (this.checked) {chkAll(<? echo $total ; ?>) ;}" />
Select All
<br />
<?
for ($item=0 ; $item<$total ; $item++) {
echo "<input name='a$item' type='checkbox' value='$item' />Item $item <br / >" ;
}
?>
<br />
<input name="Submit" type="submit" value="Submit" />
</form>
ช่วยดูในส่วน tag javaScript หน่อยนะครับ ตรง
??? ครับ
Scipt จะเขียนยังไง? ที่ต้องการคือ อยู่ใน for Loop แล้ว จะเป็น a0, a1, a2 , a3 ,.......... , a(i<num)
ขอขอบคุณล่วงหน้าครับ