大虾们,请帮帮忙(asp 的问题)

fleshstar 2002-04-02 04:45:16
错误类型:
Microsoft VBScript 编译器错误 (0x800A0401)
/asp/copy-news/admin/classify.asp, 第 115 行, 第 57 列
Response.Write "<a href='javascript:confirmDel( "& " rs("id") &")'>删除</a></td></tr>"
--------------------------------------------------------^

源代码?

<%@ Language=VBScript %>
<% option explicit %>
<!--#include file="database.asp"-->
<!--#include file="../change.inc"-->
<!--#include file="chkadmin.asp"-->
<%
dim curaction, curid, bedit, founderr, errmsg
curaction = request("action")
curid = request("id")
bedit = false
founderr = false
if curaction = "edit" then
bedit = true
end if

dim sql
'删除记录
if curaction = "delete" then
sql = "DELETE FROM category WHERE id=" + cstr(curid)
conn.execute sql
if err.number <> 0 then
response.write "数据库操作错误:" + err.description
err.clear
else
response.write "记录已经删除。"
end if
end if

'添加记录
if curaction = "newsave" then
if trim(request("txttitle")) = "" then
founderr = true
errmsg = "<p>请输入类别!</p>"
end if
if founderr then
response.write errmsg
else
sql = "INSERT INTO category(title) VALUES('"
sql = sql + cstr(request("txttitle")) + "')"
conn.execute sql
if err.number <> 0 then
response.write "无法保存,数据库操作出错:" + err.description
else
response.write "记录已经添加到数据库。"
end if
end if
end if

'保存记录
if curaction = "editsave" then
if trim(request("txttitle")) = "" then
founderr = true
errmsg = "<p>请输入类别!</p>"
end if
if founderr then
response.write errmsg
else
sql = "UPDATE category SET "
sql = sql + "title='" + htmlencode(request("txttitle")) + "'"
sql = sql + " WHERE id = " + cstr(curid)
conn.execute sql
if err.number <> 0 then
response.write "无法保存,数据库操作出错:" + err.description
else
response.write "记录已经更新到数据库。"
end if
end if

end if
%>
<html>
<head>
<title>站点更新管理</title>
<meta HTTP-EQUIV="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="../news.css">
<script language="javascript">
function confirmDel(id){
if ( confirm("你确定要删除吗?")) {
window.location.href = "classify.asp?action=delete&id=" + id
}
}

</script>
</head>

<body>
<%

dim rs
set rs = server.createobject("adodb.recordset")
sql = "SELECT * FROM category"
rs.open sql, conn, 1, 1
if err.number <> 0 then
response.write "数据库操作失败:"&err.description
else
if rs.eof and rs.bof then
response.write "没有记录"
else
%>
<table width="100%" border="1" cellspacing="0" align="CENTER" bordercolor=<%= TBCOLOR %>>
<tr bgcolor=<%= THCOLOR %>>
<td width="70%"><b>类别</b></td>
<td width="30%"><b>操作</b></td></tr>
<% do while not rs.eof
dim tdcolor
tdcolor = TDCOLORL
if bedit then
if clng(rs("id")) = clng(curid) then
tdcolor = TDCOLORD
end if
end if
response.Write "<tr bgcolor=" & tdcolor & ">"
Response.Write "<td>"& rs("title") &"</td>"
Response.Write "<td><a href='classify.asp?action=edit&id=" & cstr(rs("id")) & "'>编辑</a> "
Response.Write "<a href='javascript:confirmDel( "& " rs("id") &")'>删除</a></td></tr>"
rs.movenext
loop
Response.Write "</table>"
End If
rs.close
end if
Response.Write "<hr>"
if bedit then
sql = "SELECT * FROM category WHERE id = " + cstr(curid)
rs.open sql, conn, 1, 1
end if
%>
<form action="classify.asp" method="POST">
<p align=center><b><% If bedit then %>编辑:<% Else %>添加:<% End If %></b></p>
<table align=center cellspacing="0" cellpadding="2" border="1" bordercolor=<%= TBCOLOR %>>
<tr>
<td width="10%" bgcolor=<%= TDCOLORD %>><b>类别:</b></td>
<td width="90%" bgcolor=<%= TDCOLORL %>>
response.Write "<input type=Text name=txttitle size=50 value='"
If bedit then
response.write rs("title")
end if
Response.WRite "'></td>"
%>
</tr>
<tr><td align=center colspan="2" bgcolor=<%= TDCOLORD %>>
<input type="Hidden" name="action" value='<% If bedit then%>editsave<% Else %>newsave<% End If %>'>
<%
If bedit then
Response.Write "<input type=Hidden name=id value='"& cstr(curid) &"'>"
End If
%>
<input type="Submit" name="btnsave" value="保存">
<input type="Reset" value="取消"></td></tr>
</table>

</form>
<%
set rs = nothing
call endconnection()
%>
</body>
</html>

...全文
53 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
srnld 2002-04-02
  • 打赏
  • 举报
回复
Response.Write "<a href='javascript:confirmDel( "& rs("id") &");'>删除</a></td></tr>"
javascript的后面要一个;
siekensou 2002-04-02
  • 打赏
  • 举报
回复
下面也可以:
response.write "<a href=# OnClick=javascript:js_callpage('" & rs("ID") & "')></a>删除</a></td></tr>"
siekensou 2002-04-02
  • 打赏
  • 举报
回复
应该加两个单引号,如下:
response.write "<a href='javascript:confirmDel('" & rs("id") & "')'>删除</a></td></tr>"
hubinasm 2002-04-02
  • 打赏
  • 举报
回复
response.write "<a href='javascript:confirmDel("&rs("id") &")'>删除</a></td></tr>"

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧