#2
cnfarer2010-07-19 20:05
|
程序代码:
function add(xm,zkz){
var xm=$("#xingming").val();
var zkz=$("#zkz").val();
xm=encodeURI(xm);
$.ajax({
url: "allaction.asp?action=add&xingming="+xm+"&zkz="+zkz,
timeout: 1000,
type:'GET',
error: function(){
alert('错误1'); },
success: function(mms){
$('#left').empty();
getlist();
$('#addfk').html(($(mms).filter('div#content0').html()));
}
});
};
上面是js代码var xm=$("#xingming").val();
var zkz=$("#zkz").val();
xm=encodeURI(xm);
$.ajax({
url: "allaction.asp?action=add&xingming="+xm+"&zkz="+zkz,
timeout: 1000,
type:'GET',
error: function(){
alert('错误1'); },
success: function(mms){
$('#left').empty();
getlist();
$('#addfk').html(($(mms).filter('div#content0').html()));
}
});
};
下面是asp代码:
程序代码:
<!--#include file="conn.asp" -->
<%
action=request("action")
Select Case action
Case "getstd1"
getstd1()
Case "add"
addstd()
Case Else
Echo("Erro")
End Select
Function addstd()
xingming=VbsUnEscape(request("xingming"))
zkz=request("zkz")
if xingming<>"" and zkz<>"" then
set rs=server.CreateObject("adodb.recordset")
sqlst="select * from std where xingming='"&xingming&"' and zkz='"&zkz&"'"
rs.open sqlst,conn,1,3
if not rs.eof then
jg="该同学已经添加过了!"
else
rs.addnew
rs("xingming")=xingming
rs("zkz")=zkz
rs("lqflag")=1
rs.update
rs.close
set rs=nothing
jg="添加成功!"
call getstd1()
end if
else
jg="姓名或准考证号不能为空!"
end if
%><div id="content0">
<%response.Write jg%>
</div>
<%End Function
Function getstd1()
set rs1=server.CreateObject("adodb.recordset")
sqlst1="select * from std where lqflag=1 order by id desc"
rs1.open sqlst1,conn,1,1
rs1.pagesize=10
page1=clng(request.QueryString("page"))
if page1<1 then page1=1
if page1>rs1.pagecount then page1=rs1.pagecount
rs1.absolutepage=page1
response.Write "<div id='content1'>"
response.Write "<ul><li><span class='span1'>姓名</span><span class='span2'>准考证号</span><span class='span3'>操作1</span></li>"
for i=1 to rs1.pagesize
response.Write "<li><span class='span1'>"&rs1("xingming")&"</span><span class='span2'>"&rs1("zkz")&"</span><span class='span3'>删除</span></li>"
rs1.movenext
if rs1.EOF then exit for
next
response.Write "<li>"
if page1=1 then
response.write("首页 上一页")
response.write("<a href='javascript:getlist1("&(page1+1)&")'> 下一页</a>")
response.write("<a href='javascript:getlist1("&rs1.pagecount&")'> 未页</a>")
elseif page1=rs.pagecount then
response.write("<a href='javascript:getlist1(1)'>首页 </a>")
response.write("<a href='javascript:getlist1("&(page1-1)&")'> 上一页 </a>")
response.write("下一页 未页")
else
response.write("<a href='javascript:getlist1(1)'>首页 </a>")
response.write("<a href='javascript:getlist1("&(page1-1)&")'> 上一页</a>")
response.write("<a href='javascript:getlist1("&(page1+1)&")'> 下一页</a>")
response.write("<a href='javascript:getlist1("&rs1.pagecount&")'> 未页</a>")
end if
response.Write "</li></ul></div>"
rs1.close
set rs1=nothing
End Function
<%
action=request("action")
Select Case action
Case "getstd1"
getstd1()
Case "add"
addstd()
Case Else
Echo("Erro")
End Select
Function addstd()
xingming=VbsUnEscape(request("xingming"))
zkz=request("zkz")
if xingming<>"" and zkz<>"" then
set rs=server.CreateObject("adodb.recordset")
sqlst="select * from std where xingming='"&xingming&"' and zkz='"&zkz&"'"
rs.open sqlst,conn,1,3
if not rs.eof then
jg="该同学已经添加过了!"
else
rs.addnew
rs("xingming")=xingming
rs("zkz")=zkz
rs("lqflag")=1
rs.update
rs.close
set rs=nothing
jg="添加成功!"
call getstd1()
end if
else
jg="姓名或准考证号不能为空!"
end if
%><div id="content0">
<%response.Write jg%>
</div>
<%End Function
Function getstd1()
set rs1=server.CreateObject("adodb.recordset")
sqlst1="select * from std where lqflag=1 order by id desc"
rs1.open sqlst1,conn,1,1
rs1.pagesize=10
page1=clng(request.QueryString("page"))
if page1<1 then page1=1
if page1>rs1.pagecount then page1=rs1.pagecount
rs1.absolutepage=page1
response.Write "<div id='content1'>"
response.Write "<ul><li><span class='span1'>姓名</span><span class='span2'>准考证号</span><span class='span3'>操作1</span></li>"
for i=1 to rs1.pagesize
response.Write "<li><span class='span1'>"&rs1("xingming")&"</span><span class='span2'>"&rs1("zkz")&"</span><span class='span3'>删除</span></li>"
rs1.movenext
if rs1.EOF then exit for
next
response.Write "<li>"
if page1=1 then
response.write("首页 上一页")
response.write("<a href='javascript:getlist1("&(page1+1)&")'> 下一页</a>")
response.write("<a href='javascript:getlist1("&rs1.pagecount&")'> 未页</a>")
elseif page1=rs.pagecount then
response.write("<a href='javascript:getlist1(1)'>首页 </a>")
response.write("<a href='javascript:getlist1("&(page1-1)&")'> 上一页 </a>")
response.write("下一页 未页")
else
response.write("<a href='javascript:getlist1(1)'>首页 </a>")
response.write("<a href='javascript:getlist1("&(page1-1)&")'> 上一页</a>")
response.write("<a href='javascript:getlist1("&(page1+1)&")'> 下一页</a>")
response.write("<a href='javascript:getlist1("&rs1.pagecount&")'> 未页</a>")
end if
response.Write "</li></ul></div>"
rs1.close
set rs1=nothing
End Function
请懂的高手解决一下,谢谢!