清楚地提出我的问题
使用 sql server 2008 Enterprise 作为数据库服务器检查我的代码
表视图
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<form method="post" name="form" id="checkForm" action="update.php">
<?php
$aksi="aksi_view.php";
switch($_GET[act]){
// Tampil User
default:
echo "
<table>
<tr><th>Ap</th><th>Ccl</th><th>No</th><th>Budg</th><th>Dept</th><th>ItemID</th><th>Item Name</th><th>Qnty</th><th>UOM</th><th>Curr.</th><th>Rate</th><th>Unit Price</th>
<th>Total</th><th>Total-IDR</th></tr>";
$p = new Paging;
$batas = 20;
$posisi = $p->cariPosisi($batas);
$counter = 1;
$sql = "SELECT TOP 20 BudgetCategoryID,DeptAbbr, BudgetCategoryAbbr, ItemID, Status,
QntyDept, Qnty, CurrencyID, UnitPrice, ExchangeRateIDR, Remark,Proposal,
DeptApprovalRemark, M2ApprovalBy, M2ApprovalRemark, ItemName, PurchaseUOMName,
DecimalInQnty,(Qnty*UnitPrice) as Total, TotalIDR, CompanyDeptStock, CompanyDeptID, OutstandingNPBB
FROM vwBudgetApproval
WHERE (M2ApprovalBy IS NOT NULL OR (M2ApprovalBy IS NULL AND Status =1)) AND
CompletedInd = 1 AND DeptApprovalBy IS NOT NULL
ORDER BY BudgetCategoryID, ItemID";
$tampil = mssql_query($sql) ;
$no = $posisi+1;
while($r=mssql_fetch_array($tampil)){
// echo"$no=2 '-'";
//echo"$r[ItemID]";
$ExchangeRateIDR = number_format($r['ExchangeRateIDR'],2,',','.');
$unitprice = number_format($r['UnitPrice'],2,',','.');
$total = number_format($r['Total'],2,',','.');
$totalidr = number_format($r['TotalIDR'],2,',','.');
$warnaGenap = "#66CCFF"; // warna abu-abu
$warnaGanjil = "#FFFFFF"; // warna putih
if ($counter % 2 == 0) $warna = $warnaGenap;
else $warna = $warnaGanjil;
echo "<tr bgcolor='".$warna."'>
<td><input type= 'checkbox' name='approve".$no."' id='approve' value='".$r['ItemID']."' onclick='onClickFn()'></td>
<td><input type= 'checkbox' name='cancel".$no."' id='cancel' value='".$r['ItemID']."' onclick='onClickFn()'></td>
<td>$no</td>
<td>$r[BudgetCategoryAbbr]</td>
<td>$r[DeptAbbr]</td>
<td>$r[ItemID]</td>
<td>$r[ItemName]</td>
<td>$r[Qnty]</td>
<td>$r[PurchaseUOMName]</td>
<td>$r[CurrencyID]</td>
<td>$r[ExchangeRateIDR]</td>
<td>$unitprice </td>
<td>$total</td>
<td>Rp $totalidr</td>";
$no++;
$counter++;
}
echo "</table>";
?>
页面的显示
现在我希望用户在选中一个复选框时另一个复选框禁用我使用 java 脚本的功能。这是我的代码
<script type="text/javascript">
function onClickFn(){
$("approve").click(function(){
if ($(this).prop("checked"))
{
$("cancel").prop("checked",false);
}
});
$("cancel").click(function(){
if ($(this).prop("checked"))
{
$("approve").prop("checked",false);
}
})
};
</script>
但该功能不起作用。