错!错!错!到底错在那儿了?

xuemei2xiehong 2004-12-27 04:49:27
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%response.Expires=0%>
<%Response.Buffer=-1%>
<!-- #include file="conn.asp" -->
<!--#include file="security.asp"-->
<%
set rs=server.createobject("adodb.recordset")
sql="select count(*) as n from gonggao"
rs.open sql,conn,1,1
if request("action")="add" then
if Cint(rs.fields("n"))>8 or Cint(rs.fields("n"))=8 then
response.Write("<script>alert('已有8条公告信息,请您先执行删除操作!');history.go(-1)</script>")
else
response.Redirect("append.htm")
end if
end if

if request("action")="update" then
if isempty(request("id")) then
response.Write("<script>alert('请您选择一条公告,进行修改!');</script>")
end if
if not isempty(request("id")) then
idlist=request("id")
if instr(idlist,",")>0 then
response.write("<script>alert('请您选择一条公告,进行修改!');</script>")
else
Response.Redirect("xiogai.asp?id="&request("id")&"")
end if
end if
end if
rs.close
sql1="select count(*) as shu from gonggao "
rs.open sql1,conn,1,1
totalcount=0
totalcount=rs.fields("shu")
rs.close
rs.open "select * from gonggao order by addtime desc",conn,1,2
%>
<html>
<head>
<head>
<script language="JavaScript" type="text/JavaScript">
function a(){
document.form1.action="update.asp?action=update";
document.form1.submit();
}
function b(){
document.form1.action="update.asp?action=add";
document.form1.submit();
}
</script>
<title>企业公告修改页面</title>
</head>
<body>
<p align="center"><strong><font size="5">修改和增加企业公告 </font></strong> </p>
<form name="form1" method="post" action="">
<table border="1" width="95%" cellpadding="1" cellspacing="0" bordercolordark="#FFFFFF" bordercolorlight="#00215a" align="center">
<tr bgcolor="#99CCFF">
<td width="60%" height="20" align="center" bgcolor="#FF9900">公告内容</td>
<td width="30%" height="20" align="center" bgcolor="#FF9900">添加时间</td>
<td width="5%" height="20" align="center" bgcolor="#FF9900">选择</td>
</tr>
<%
do while Not rs.Eof
id=rs.fields("id")
%>
<tr>
<td bordercolorlight="#00215a" align=left width="60%"><%=rs.fields("content")%></td>
<td bordercolorlight="#00215a" align=center width="30%"><%=rs.fields("addtime")%></td>
<td bordercolorlight="#00215a" align=center width="5%">
<input type='checkbox' name='id' value='<%=cstr(id)%>'></td>
</tr>
<%
RS.MoveNext
Loop%>
<tr><td colspan=3 align=middle bordercolorlight="#00215a"><b>本站现有<%=totalcount%>条新闻</b></td></tr>
</table>
<table border=0 align="center">
<tr ><td>
<img src="tubiao/admin-xiugai.gif" width="57" height="23" onClick=a()> ‘修改图片按钮
</td>
<td>
<img src="tubiao/admin-zengjia.gif" width="57" height="23" onclick=b()></td> '删除图片按钮
</tr>
</table></form>
</body>
</html>
运行上面的update.asp中的语句之后,点击删除图片按钮时,ie的报错如下:
行:3
字符:29
错误:无效字符
代码:0
url:http://localhost:2316/gonggao/admin/update.asp?action=add
是什么问题,望高手指正!

...全文
124 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
jarraytan 2004-12-29
  • 打赏
  • 举报
回复
hhjjhjhj(大头)(想变胡萝卜^^)在胡扯,可以在form的链接中添加参数,尽管用的是post方法,只要在update.asp页面中用action=Trim(Request.QueryString("action"))就可以提取action值,没必要添加隐藏域。form中的参数仍然用Trim(Request.Form(""))提取,两者不影响,我一向都是这么做的。

你没用过不要断言啊。。。汗。。。
adventure007 2004-12-27
  • 打赏
  • 举报
回复
同意“hhjjhjhj(大头)(想变胡萝卜^^) ”的
hhjjhjhj 2004-12-27
  • 打赏
  • 举报
回复
document.form1.action="update.asp?action=add";-------这是不合理的,“?action=add”这是GET方法,而FORM提交是POST方法,
应该在FORM中加一个隐藏的INPUT
function b(){
document.form1.action="update.asp";
document.form1.myaction.value="add";
document.form1.submit();
}
.........
<input type=hidden name="myaction" value="">
........

request("action")改成request("myaction")

mzhmark 2004-12-27
  • 打赏
  • 举报
回复
<!-- #include file="conn.asp" -->
#前是不能有空空格的
riyao 2004-12-27
  • 打赏
  • 举报
回复
sql="select count(*) as n from gonggao"
这一句的FIELDS应该只有一个。。
xuemei2xiehong 2004-12-27
  • 打赏
  • 举报
回复
if request("action")="add" then
if Cint(rs.fields("n"))>8 or Cint(rs.fields("n"))=8 then
response.Write("<script>alert('已有8条公告信息,请您先执行删除操作!');history.go(-1)</script>")
else
response.Redirect("append.htm")
end if
end if
wanjun830 2004-12-27
  • 打赏
  • 举报
回复
那么长的代码怎么看啊!

给出来具体的!

28,391

社区成员

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

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