Viewing file: v_checkboxTcm.php (2.42 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 = "";
$('#tcmName', window.opener.document).val("");
$("input[type=checkbox]:checked").each(function(index) {
choice += "- "+$("#text"+this.value).text()+"\n";
inp +="<input type=\"hidden\" name=\"tmc[]\" value=\""+this.value+"\">";
});
$('#tcmName', window.opener.document).val(choice);
$('#inp', 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="domCol">เลือก</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('tcmId', $row->tcmId);
?></td>
<td colspan='2'><div id="text<?=$row->tcmId;?>"><?php
echo $row->tcmName;
?></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='2'>ไม่พบวิธีการสอน</th>
</tr>
<?php
}
?>
</table>
|