<form name="frm" method="post" action="/add" onsubmit="return check()">
<table class="titem" >
<tr>
<td class="field"> * 所属批次</td>
<td class="value">
<select name="stockmst_id" id="stockmst_id">
{html_options options=$stockmst_arr selected=$stockmst_id}
</select>
</td>
<td>
<input type="submit" value="提交" id="Btn" />
</td>
<td>
<input type="button" value="返回" onclick="javascript:document.location.href='list?';" />
</td>
</tr>
</table>
</form>
{if $poList}
<form action="/PurchaseOrderCleanLocation/doAdd" method="post" name="form1" onsubmit="return checkBoxSelect()">
<table class="tlist">
<thead>
<tr class="title">
<td><strong><input id="chkAll" type="checkbox" onclick="javascript:checkAll();">全选</strong></td>
<td><strong>所属批次</strong></td>
<td><strong>单号</strong></td>
<td><strong>单名称</strong></td>
<td><strong>类别</strong></td>
<td><strong>状态</strong></td>
</tr>
</thead>
<tbody>
{foreach $poList as $key=>$tpc}
<tr>
<td>
<input type="checkbox" name="pom_ids[]" onclick="javascript:checkChecked();" value="{$tpc.pom_id}" />
</td>
<td>{$tpc.pom_stock_name}</td>
<td>{$tpc.pom_code}</td>
<td>{$tpc.pom_name}</td>
<td>{$tpc.pom_type_name}1</td>
<td>{$tpc.pom_status}</td>
</tr>
{/foreach}
<tr>
<td align="left" colspan="6"><input type="submit" name="sub" value="提交" /></td>
</tr>
</tbody>
</table>
</form>
{/if}
<div>
<script type="text/javascript">
function checkBoxSelect(){
var falg = 0;
$("input[name='pom_ids[]']:checkbox").each(function () {
if ($(this).attr("checked")) {
falg =1;
return false;
}
})
if (falg > 0)
return true;
else {
alert("亲,至少要选一项才能提交!");
return false;
}
}
function checkAll()
{
var objCheckAll = document.getElementById("chkAll");
var arrObjInput = document.getElementsByTagName("input");
for(intI = 0 ; intI < arrObjInput.length ; intI ++)
{
if(arrObjInput[intI].type == "checkbox" && arrObjInput[intI].id != "chkAll")
{
if(objCheckAll.checked == true )
{
arrObjInput[intI].checked = true;
}
else
{
arrObjInput[intI].checked = false;
}
}
}
}
function checkChecked()
{
var objCheckAll = document.getElementById("chkAll");
var arrObjInput = document.getElementsByTagName("input");
var blnChecked = true;
for(intI = 0 ; intI < arrObjInput.length ; intI ++)
{
if(arrObjInput[intI].type == "checkbox" && arrObjInput[intI].id != "chkAll")
{
if(arrObjInput[intI].checked == false)
{
blnChecked = false;
}
}
}
objCheckAll.checked = blnChecked;
}
</script>