一段代码输出问题,解决马上散分,在线等

skycuilin 2005-11-14 02:05:08
下面代码错误处已经标明,


<%
newsID=GetSafeInt(request("newsID"),0)
list=GetSafeInt(request("list"),0)
znum=GetSafeInt(request("znum"),0)
tj=GetSafeInt(request("tj"),0)
if list<1 then
list=3
end if
if znum<1 then
znum=10
end if

if newsID<1 then
TempContent=TempContent&"数据参数出错"
else
TempContent=TempContent&"<table width=279 border=0 cellspacing=0 cellpadding=0>"
select case tj
case 1
sqlx="select * from zg_article where articleTypeID="&newsID&" order by addDate desc"
case 2
sqlx="select * from zg_article where articleTypeID="&newsID&" order by addDate desc"
case else
sqlx="select * from zg_article where articleTypeID="&newsID&" order by addDate desc"
end select
openrs rsx,sqlx,1,1
if not rsx.eof then
i=1
do while not rsx.eof



if i=1 then
TempContent=TempContent&"<tr><td height=20 bgcolor=#F1F1F1>"
TempContent=TempContent&"<span class=cy_xinxi>·</span><a href=/news/"&rsx("htmlurl")&" class=cy_xinxi_1 target=_blank>"&left(rsx("title"),znum)&"</a></td></tr>"
TempContent=TempContent&"<tr><td height=150 bgcolor=#F1F1F1>"
'======================================================================
'=======================================================================
'此段代码出错,数据无法输出,曾实验过content=left(rsx("content"),37)最多输出37个,超过37不能输出,其他地方无错,noencode函数用于去除格式
'======================================================================
content=left(replace(replace(replace(replace(noEncode(rs("content"))," ","")," ",""),"<P>",""),"</P>",""),150)
TempContent=TempContent&"<span class=cy_zicun>  "&content&"...</span><span class=cy_xw_1>[正文]</span>"
'============================================================================
'============================================================================
'============================================================================

TempContent=TempContent&"</td></tr>"
else
TempContent=TempContent&"<tr>"
TempContent=TempContent&"<td height=19 valign=bottom>"
TempContent=TempContent&"·<a href=/news/"&rsx("htmlurl")&" class=cy_xinxi target=_blank>"&left(rsx("title"),znum)&"</a></td>"
TempContent=TempContent&"</tr>"

end if
i=i+1

rsx.movenext
list=list-1
if list<1 then exit do
loop
closers rsx
else
TempContent=TempContent&"<tr><td> </td></tr>"
end if
TempContent=TempContent&"</table>"
end if
%>
document.write("<%=TempContent%>")
...全文
128 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
skycuilin 2005-11-21
  • 打赏
  • 举报
回复
改用其他方法实现了,谢谢各位回复
skycuilin 2005-11-14
  • 打赏
  • 举报
回复
已经找到了最终原因,此段代码输出为
第一大武器:多洒男人香
电影《闻香识女人》中艾尔.帕西诺凭着

在第一行的最后"香字后"虽然没有换行符,但是他在js中生成了换行,请问如何解决.解决马上散分.
lnboy1003 2005-11-14
  • 打赏
  • 举报
回复
ding
skycuilin 2005-11-14
  • 打赏
  • 举报
回复
用response.write(left(replace(replace(replace(replace(noEncode(rs("content"))," ","")," ",""),"<P>",""),"</P>",""),150))
直接输出的结果值并不包含'和"",多次输出结果都是停止在"第一大武器",没有输出后面的":"


下列为输出:
第一大武器:多洒男人香电影《闻香识女人》中艾尔.帕西诺凭着女人身上的香水气味,虽然双目失明,竟也能道出对方的外形,甚至头发,眼睛以及嘴唇的细节,仿佛男人对香水特别的敏感,会被女人深深迷倒。遗憾的是,只是有少部分男人能够清楚地分辨香水味,相反女人却是香水的敏感者,她们拥有细致的嗅觉,从原始的本
skycuilin 2005-11-14
  • 打赏
  • 举报
回复
双引号和单引号的ascII谁知道啊
明珠佩佩 2005-11-14
  • 打赏
  • 举报
回复
把content单独输出看看是什么样的

如果left出错,换mid看看呢
skycuilin 2005-11-14
  • 打赏
  • 举报
回复
楼上仁兄说的有理,应该是替换过程中出错,等下解决问题散分,希望各位老兄贴几个替换"和'的函数出来。
skycuilin 2005-11-14
  • 打赏
  • 举报
回复
function noEncode(fString)
if not isnull(fString) then
fString = replace(fString, ">" , ">")
fString = replace(fString, "<" , "<")
fString = Replace(fString, " ", CHR(32))
fString = Replace(fString, """, CHR(34))
fString = Replace(fString, "'", CHR(39))
fString = Replace(fString, "", CHR(13))
fString = Replace(fString, "</P><P>", CHR(10) & CHR(10))
fString = Replace(fString, "<BR>", CHR(10))
noEncode = fString
end if
end function
jspadmin 2005-11-14
  • 打赏
  • 举报
回复
最主要是因为你要输出的内容里含有""或'等特殊字符,造成不能正确输出,你试试输出纯普通字符的内容,如果能正确输出,就想办法解决特殊字符的替换或输出吧
-----------------------------------------------------------------------------
欢迎光临我的小站http://www.pifoo.com 有什么问题可以给我留言http://www.pifoo.com/guestbook/ 我的QQ:33323489
QCB181 2005-11-14
  • 打赏
  • 举报
回复
noencode
函数贴出来
zhanghongwen 2005-11-14
  • 打赏
  • 举报
回复
太多了,头晕了.

UP

28,406

社区成员

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

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