Viewing file: v_checkboxPrs.php (2.73 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<script language="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" ></script> <script language="JavaScript"> function ReturnValue() { var choice = ""; var inp = ""; $('#prsbox', window.opener.document).val(""); $("input[type=checkbox]:checked").each(function(index) { choice += "- "+$("#text"+this.value).text()+"\n"; inp +="<input type=\"hidden\" name=\"prs[]\" value=\""+this.value+"\">"; }); $('#prsbox', window.opener.document).val(choice); $('#prsset', window.opener.document).html(inp); window.opener.checkSubmit(); window.close(); } $(document).ready(function(){ //get_option();
$("button[name='selectall']").click(function () { $('[type=checkbox]').attr('checked', true); }); $("button[name='cancel']").click(function () { $('[type=checkbox]').attr('checked', false); }); }); </script> <table class="headCol"> <tr> <th class="stdCodeCol">ค้นหา ชื่อ หรือ นามสกุล</th> <th colspan='2'> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> <input type="text" Name="name_teach" /> <input type="submit" value="ค้นหา"></th> </form> </tr> <tr> <th class="stdCodeCol">เลือก</th> <th colspan='2'>ชื่ออาจารย์</th> </tr> <?php if($qu->num_rows() > 0){ $i=0; foreach($qu->result() as $row){ echo "<tr onmouseover=\"bgColor='".$tr_color_even."'\" onmouseout=\"bgColor='".$this->config->item("rg_mouseout")."'\">"; ?> <!-- <tr> --> <td align='center'><?php echo form_checkbox('prsId', $row->prsId); ?></td> <td colspan='2'><div id="text<?=$row->prsId;?>"><?php echo $row->name; ?></div></td> </tr> <?php $i++; } ?> <tr bgcolor="<?php echo $tr_color_even;?>"> <td colspan='2' align='left'><?php echo form_button('selectall', 'เลือกทั้งหมด').nbs(1); echo form_button('cancel', 'ยกเลิกทั้งหมด'); ?></td> <td align='right' ><font size="2"> <?php echo 'รวม '.$qu->num_rows().' รายการ'.nbs(2); ?></font></td> </tr> <tr bgcolor="#ffffff"> <td colspan='3' align='center'><input type="submit" value="บันทึก" name="submit" onClick="ReturnValue();"></td> </tr> <?php }else{ ?> <tr bgcolor="#ffffff"> <td colspan='3' align="center">ไม่พบอาจารย์ผู้สอน</th> </tr> <?php } ?>
</table>
|