|
|
|
คือหนูทำแล้วพอคลิกเลือกทั้งหมดมันไม่ยอมเลือกให้ค่ะ |
|
|
|
|
|
|
|
Code (PHP)
<script language="JavaScript">
function ClickCheckAll(vol)
{
var i=1;
for(i=1;i<=document.frmMain.hdnCount.value;i++)
{
if(vol.checked == true)
{
eval("document.frmMain.Chk"+i+".checked=true");
}
else
{
eval("document.frmMain.Chk"+i+".checked=false");
}
}
}
</script>
<?
if ($room <> "")
{
include "connect.php";
mysql_select_db($dbname,$m)or die("ไม่สามารถเชื่อมต่อกับฐานข้อมูลได้").mysql_error();
mysql_query("SET NAMES UTF8")
$sql="select * from fix_tea WHERE id_teacher='$valid_user' and year_fix = '$fix_year'order by class_fix ASC";
$result=mysql_query($sql,$m)or die("ไม่สามารถเชื่อมต่อกับฐานข้อมูลได้").mysql_error();
while($rs=mysql_fetch_array( $result)){
$class_fix = $rs["class_fix"];
$sql1="select * from room WHERE id_room='$class_fix' order by id_room ASC";
$result1=mysql_query($sql1,$m)or die("ไม่สามารถเชื่อมต่อกับฐานข้อมูลได้").mysql_error();
$rs1=mysql_fetch_array($result1);
$room1 = $rs1["room"];
?>
<input type="radio" name="class" value="<?=$rs['class_fix']?>" <? if($room==$rs['class_fix']){
echo " checked='checked'";}?> onclick="location.href='messages_tea.php?room='+this.value"><?=$rs1['room']?>
<?php } ?>
</font></td></tr>
<tr>
<td> <input name="CheckAll" type="checkbox" id="CheckAll" value="Y" onClick="ClickCheckAll(this);"></td>
<td ><font color="#000000" size="3" face="Arial, Helvetica, sans-serif">ลำดับ</font></td>
<td ><font color="#000000" size="3" face="Arial, Helvetica, sans-serif">รหัส</font></td>
<td><font color="#000000" size="3" face="Arial, Helvetica, sans-serif">ชื่อ - นามสกุล</font></td>
</tr>
<?
$num = 0;
$sql="SELECT*FROM student WHERE room = '$room'";
$result=mysql_query($sql,$m)or die("ไม่สามารถเชื่อมต่อกับฐานข้อมูลได้").mysql_error();
while($rs=mysql_fetch_array($result))
{
$num = $num+1 ;
?>
<tr>
<td><input type="checkbox" name="chk[]" id="chk<?=$i;?>" value="<?=$rs["id_student"];?>"></td>
<td><font color="#000000" size="3" face="Arial, Helvetica, sans-serif"><?=$num?>.</font></td>
<td ><font color="#000000" size="3" face="Arial, Helvetica, sans-serif"><?=$rs[id_student]?></font></td>
<td ><font color="#000000" size="3" face="Arial, Helvetica, sans-serif"><a href="messages_tea2.php?CusID=<?=$rs["id_student"]?>"><?=$rs[title_name]?><?=$rs[name_stu]?> <?=$rs[lastname_stu]?></a></font></td>
</tr>
<?
}
}
?>
Tag : PHP, Ms SQL Server 2005
|
|
|
|
|
|
Date :
2011-01-26 15:24:46 |
By :
deedee2338 |
View :
666 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function ClickCheckAll(vol)
03. {
04.
05. var i=1;
06. for(i=1;i<=document.frmMain.hdnCount.value;i++)
07. {
08. if(vol.checked == true)
09. {
10. eval("document.frmMain.Chk"+i+".checked=true");
11. }
12. else
13. {
14. eval("document.frmMain.Chk"+i+".checked=false");
15. }
16. }
17. }
18.</script>
alert(Vol) ดูค่าที่ส่งมาเป็นอะไร
|
|
|
|
|
Date :
2011-01-26 16:55:57 |
By :
แดง |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วค่ะขอบคุณค่ะ
|
ประวัติการแก้ไข 2011-01-27 19:59:17
|
|
|
|
Date :
2011-01-26 21:19:28 |
By :
deedee2338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|