关于文本框提交html语言的疑问

rufo 2009-10-22 11:28:19
我用wml写了一个后台,用来修改已提交的文章,

代码如下:
<wml>
<head>
<meta http-equiv="Cache-Control" content="max-age=0"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
</head>
<card id="index" title="文章后台">
<p align="left">
<%
Dim rs
set rs=server.createobject("adodb.recordset")
rs.Open "select ID,title,KeyWords,ArticleContent,Origin,author from [Article] where ID="&request("ID"),conn,1,1

%>

标题:<input name="title" emptyok="true" size="8" type="text" value="<%=rs("title")%>"/><br/>
相关:<input name="KeyWords" emptyok="true" size="8" type="text" value="<%=rs("KeyWords")%>"/><br/>
栏目:
<select name="Tid">
<%
Call Showclass(FolderID,ChannelID)
%>
</select>
<br/>
内容:<input name="ArticleContent" emptyok="true" size="15" type="text" value='<%=rs("ArticleContent")%>'/><br/>
来源:<input name="Origin" emptyok="true" size="8" type="text" value="<%=rs("Origin")%>"/><br/>
作者:<input name="author" emptyok="true" size="8" type="text" value="<%=rs("author")%>"/><br/>
<anchor>提交
<go href="editarticle.asp?ID=<%=request("ID")%>" method="post" accept-charset="utf-8">
<postfield name="title" value="$(title)" />
<postfield name="ArticleContent" value="$(ArticleContent)" />
<postfield name="Tid" value="$(Tid)" />
<postfield name="Origin" value="$(Origin)" />
<postfield name="author" value="$(author)" />
<postfield name="KeyWords" value="$(KeyWords)" />
</go>
</anchor>
<%
rs.close
set rs=nothing
%>
</p>
</card>
</wml>


代码经测试是可运行的,但是,如果ArticleContent这个文本框中的内容<%=rs("ArticleContent")%>含有html代码就会造成出错。我应该如何更改?谢谢!

提示一下:我添加文章时,ArticleContent文本框含有html代码是可以提交的,只是在修改的时候,ArticleContent文本框读取出含有html代码才会出错。
...全文
79 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
lfcms 2009-10-23
  • 打赏
  • 举报
回复
在入库前 就应该过滤了
Dogfish 2009-10-23
  • 打赏
  • 举报
回复
<%
s = rs("ArticleContent")
s = replace(s, "<", "<")
s = replace(s, ">", ">")
s = replace(s, "'", "‚")
%>
内容: <input name="ArticleContent" emptyok="true" size="15" type="text" value='<%=s%>'/> <br/>

28,391

社区成员

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

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