已通过!太感谢了老师:
但是还有个问题我弄了一天了还是没弄好!
就是在查询结果的每条信息前加一个复选框,选中的信息才插入发票号,没选中的没插入,我弄了好几天都没弄好,参考8楼老师的代码我做如下修改,但达不到效果?怎么回事?
<%
if request.form("Submit")="开票" then
fapiao=Trim(request.form("fapiao"))
id=request.form("id")
if id<>"" and not isnull(id) then
conn.execute "update xiaoshou set fapiao='"&fapiao&"' where id in ("&id&")"
response.redirect Request.ServerVariables("HTTP_REFERER")
end if
end if
%>
<table border="1" width="100%" cellspacing="0" cellpadding="0" style="border-collapse:collapse;" bordercolor="#C0C0C0">
<tr height="20" align="center">
<td>选择</td>
<td>单号</td>
<td>公司代码</td>
<td>货物价格</td>
<td>货物名称</td>
<td>数量</td>
</tr>
<form method="post">
<%
Gname=request.form("Gname")
Set rs=server.createobject("adodb.recordset")
rs.open "select id,Number,Comm,Price,Uname,shuliang from xiaoshou where Gname='"&Gname&"' order by id desc",conn,1,1
Set id=rs("id")
Set number=rs("number")
Set Comm=rs("Comm")
Set Price=rs("Price")
Set Uname=rs("Uname")
Set shuliang=rs("shuliang")
do while not rs.eof
%>
<input type="hidden" name="id" value="<%=id%>" />
<tr height="20" align="center">
<td><input name="id" type="checkbox" id="id" value="<%=cstr(rs("id"))%>"></td>
<td><%=number%></td>
<td><%=Comm%></td>
<td><%=Price%></td>
<td><%=Uname%></td>
<td><%=shuliang%></td>
</tr>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
<tr height="20" align="center">
<td ><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
全选</td>
<td colspan="6"><input type="text" name="fapiao" /> <input type="Submit" name="Submit" value="开票" /></td>
</tr>
</form>
<SCRIPT language=javascript>
//全选功能
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.Name != "chkAll")
e.checked = form.chkAll.checked;
}
}
</SCRIPT>
</table>
[[it] 本帖最后由 anjincheng 于 2008-6-14 19:42 编辑 [/it]]
但是还有个问题我弄了一天了还是没弄好!
就是在查询结果的每条信息前加一个复选框,选中的信息才插入发票号,没选中的没插入,我弄了好几天都没弄好,参考8楼老师的代码我做如下修改,但达不到效果?怎么回事?
<%
if request.form("Submit")="开票" then
fapiao=Trim(request.form("fapiao"))
id=request.form("id")
if id<>"" and not isnull(id) then
conn.execute "update xiaoshou set fapiao='"&fapiao&"' where id in ("&id&")"
response.redirect Request.ServerVariables("HTTP_REFERER")
end if
end if
%>
<table border="1" width="100%" cellspacing="0" cellpadding="0" style="border-collapse:collapse;" bordercolor="#C0C0C0">
<tr height="20" align="center">
<td>选择</td>
<td>单号</td>
<td>公司代码</td>
<td>货物价格</td>
<td>货物名称</td>
<td>数量</td>
</tr>
<form method="post">
<%
Gname=request.form("Gname")
Set rs=server.createobject("adodb.recordset")
rs.open "select id,Number,Comm,Price,Uname,shuliang from xiaoshou where Gname='"&Gname&"' order by id desc",conn,1,1
Set id=rs("id")
Set number=rs("number")
Set Comm=rs("Comm")
Set Price=rs("Price")
Set Uname=rs("Uname")
Set shuliang=rs("shuliang")
do while not rs.eof
%>
<input type="hidden" name="id" value="<%=id%>" />
<tr height="20" align="center">
<td><input name="id" type="checkbox" id="id" value="<%=cstr(rs("id"))%>"></td>
<td><%=number%></td>
<td><%=Comm%></td>
<td><%=Price%></td>
<td><%=Uname%></td>
<td><%=shuliang%></td>
</tr>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
<tr height="20" align="center">
<td ><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
全选</td>
<td colspan="6"><input type="text" name="fapiao" /> <input type="Submit" name="Submit" value="开票" /></td>
</tr>
</form>
<SCRIPT language=javascript>
//全选功能
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.Name != "chkAll")
e.checked = form.chkAll.checked;
}
}
</SCRIPT>
</table>
[[it] 本帖最后由 anjincheng 于 2008-6-14 19:42 编辑 [/it]]
我是农家的孩子,我有农家孩子的本色!