问题描述
程序代码如下。<!--#includefile="../../Connections/conn.asp"--><html><head><title>领导信箱</title><scriptlanguage="javascript"src="js/jquery-1.3.js"></script><scriptlanguage="javascript">functionReply(id){varcontent=document.getElementById(id+"_recontent").value;$.get("ajax.asp",{Num:id,content:content},function(data){if(data=='Success'){alert("回复成功");//window.location.reload();}else{alert("回复失败");}});}</script><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"><styletype="text/css"><styletype="text/css"><!--body,td,th{font-size:12px;}a:link{color:#6600FF;text-decoration:none;}a:visited{text-decoration:none;color:#6600FF;}a:hover{text-decoration:none;color:#FF0000;}a:active{text-decoration:none;}--></style></head><body><%SetConn=Server.CreateObject("ADODB.Connection")Conn.openMM_conn_STRINGsetrs=Server.CreateObject("adodb.Recordset")sqlstmt="SELECT*fromtb_Messageorderbytjsjdesc"rs.opensqlstmt,Conn,1,1Ifrs.eofthenresponse.write"数据库中没有记录"response.endelsers.pagesize=10page=cint(request("page"))ifpage<1thenpage=1endififpage>rs.pagecountthenpage=rs.pagecountendifrs.absolutepage=page%><pclass="STYLE1"> 信箱管理</p><formaction=""method="post"name="form1"id="form1"><tablewidth="98%"border="0"cellpadding="1"cellspacing="1"bgcolor="#ccccff"><tralign="center"valign="middle"><tdheight="25"colspan="6"align="center"class="title1"title="领导信箱"><divalign="left"> 领导信箱</div></td></tr><tr><tdalign="center"bgcolor="#FFFFFF"><strong>标题</strong></td><tdalign="center"bgcolor="#FFFFFF"><strong>内容</strong></td><tdwidth="159"align="center"bgcolor="#FFFFFF"><strong>发布人</strong></td><tdwidth="179"align="center"bgcolor="#FFFFFF"><strong>发布时间</strong></td><tdwidth="119"align="center"bgcolor="#FFFFFF"><strong>删除</strong></td><tdwidth="119"align="center"bgcolor="#FFFFFF"><strong>状态</strong></td></tr><%Dowhilenotrs.eof%><tr><tdwidth="114"align="center"bgcolor="#FFFFFF"><%=rs("Title")%></td><tdwidth="215"align="center"bgcolor="#FFFFFF"><%=rs("Content")%></td><tdwidth="159"align="center"bgcolor="#FFFFFF"><%=rs("UserName")%></td><tdwidth="179"align="center"bgcolor="#FFFFFF"><%=rs("tjsj")%></td><tdwidth="119"align="center"bgcolor="#FFFFFF"><ahref="message_del.asp?M_id=<%=rs("M_id")%>"onClick="{if(confirm('确定要删除吗?')){returntrue;}returnfalse;}">删除</a></td><tdwidth="119"align="center"bgcolor="#FFFFFF"><%if(rs.Fields.Item("huifu").Value)=0then%>未回复<%else%>已回复<%endif%></td></tr><tr><tdalign="center"bgcolor="#FFFFFF"> </td><tdalign="center"bgcolor="#FFFFFF"> </td><tdcolspan="2"align="center"bgcolor="#FFFFFF"><textareaname="recontent"cols="60"rows="10"id="<%=rs("M_id")%>_recontent"></textarea><spanstyle="color:#FF0000;">*</span></td><tdalign="center"bgcolor="#FFFFFF"> </td><tdalign="center"bgcolor="#FFFFFF"> </td></tr><tr><tdalign="center"bgcolor="#FFFFFF"> </td><tdalign="center"bgcolor="#FFFFFF"> </td><tdcolspan="2"align="center"bgcolor="#FFFFFF"><inputname="提交"type="submit"onclick='Reply(<%=rs("M_id")%>)'value="回复"></td><tdalign="center"bgcolor="#FFFFFF"> </td><tdalign="center"bgcolor="#FFFFFF"> </td></tr><%rs.MoveNextloop%></table><br><tablewidth="98%"border="0"cellpadding="1"cellspacing="1"bgcolor="#ccccff"><tr><tdheight="20"colspan="4"bgcolor="#799AE1"><tablewidth="100%"border="0"cellspacing="0"cellpadding="0"><tr><tdwidth="10%"> </td><tdwidth="79%"><%response.write"<center>"ifpage<>1thenresponse.Write"<ahref=message_manage.asp?page=1>首页</a>"&""response.Write"<ahref=message_manage.asp?page="&page-1&">上一页</a>"&""endifforn=1tors.pagecountresponse.write"<ahref=message_manage.asp?page="&n&">"&"["&n&"]"&"</a>"&""nextifpage<>rs.pagecountthenresponse.Write"<ahref=message_manage.asp?page="&page+1&">下一页</a>"&""response.Write"<ahref=message_manage.asp?page="&rs.pagecount&">末页</a>"endifresponse.write"</center>"%></td><tdwidth="11%"> </td></tr></table></td></tr></table><inputtype="hidden"name="M_id"value="<%=M_id%>"></form><%rs.closesetrs=nothingendif%></body></html><!--ajax.asp--><!--#includefile="../../Connections/conn.asp"--><%DimNum,sqlstmt,recontent,Str,RsNum=Request("Num")recontent=Request("content")SetConn=Server.CreateObject("ADODB.Connection")Conn.openMM_conn_STRINGsqlstmt="UPDATEtb_MessageSEThuifu=1whereM_id='"+num+"'"Conn.executesqlstmtsetRs=Server.CreateObject("adodb.Recordset")sqlstmt="select*fromtb_MessagewhereM_id='"+num+"'"Rs.opensqlstmt,Conn,1,3onerrorresumenextsqlstmt="UPDATEtb_MessageSETreContent='"+recontent+"'"sqlstmt=sqlstmt&"WHEREM_id="&num&""Conn.executesqlstmtRs.closesetRs=nothingConn.CloseSetConn=NothingIfErrThenStr="fail"elseStr="Success"endifResponse.ClearResponse.CharSet="GB2312"Response.ContentType="text"Response.Write(Str)Response.End()%>
解决方案
本帖最后由 herrytmc 于 2011-11-16 23:14:48 编辑
解决方案二:
全部使用utf-8.包括文件保存的编码。
解决方案三:
我试过了,没用啊,更新数据之后还是乱码。
解决方案四:
编码的问题。确定你的编码。用排除法一个一个试!