关于文件上传的空格处理问题,李文救我!!!!!!

fish699 2003-10-17 02:56:44
我现在有一个新闻上传的文件,但是上传以后的新闻经过流揽,却是把原来段落都放在一个段落里。举个例子:
我是小鱼儿我现在有一个新闻上传的文件我现在有一个新闻上传的文件我现在有一个新闻上传的文件。

我是小鱼儿我现在有一个新闻上传的文件我现在有一个新闻上传的文件我现在有一个新闻上传的文件
结果:我是小鱼儿我现在有一个新闻上传的文件我现在有一个新闻上传的文件我现在有一个新闻上传的文件。我是小鱼儿我现在有一个新闻上传的文件我现在有一个新闻上传的文件我现在有一个新闻上传的文件。
有哪位高手知道的。指点一下,需要源的代码的尽管说!
...全文
113 63 打赏 收藏 转发到动态 举报
写回复
用AI写文章
63 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhang_luo 2003-10-20
  • 打赏
  • 举报
回复
怎么搞的啊???
这是放在你显示页面不是放在添加页面
就是说:假如你用a.asp显示
则:你要显示内容的地方应该这样:
<%Content=replace(rs("content"),chr(13),"<BR>") 这一句是处理“回车”
Content=replace(content,chr(32)," ")%> 这一句是处理“空格”
<td width=100 ><%response.write Content%>这一句就是显示Content也就是你的内容
添加数据里你把字段类型设置为备注就可以了,然后常规提交入库(不用搞的那么复杂)
然后利用上面的代码就可以显示了(你在入库的时候是什么排版格式,显示的时候也就是什么格式了)
avonqin 2003-10-20
  • 打赏
  • 举报
回复
不知道你怎么搞的了
你怎么那么多马甲呀?
现在什么问题了?
maomao093152 2003-10-20
  • 打赏
  • 举报
回复
凝狐,薄线在改成这样:
Content=replace(rs("content"),chr(13),"<BR>")
Content=replace(content,chr(32)," ")
结果:Microsoft VBScript 运行时错误 (0x800A000D)
/enterprise/asp/addnews.asp, 第 28 行也就是:
Content=replace(rs("content"),chr(13),"<BR>")
maomao093152 2003-10-20
  • 打赏
  • 举报
回复
李文,怎么还是不行呢?sql2="select .paretid,……"没有错啦。因为我在sql里面验证过的哦
maomao093152 2003-10-20
  • 打赏
  • 举报
回复
等一下,我调试一下
zhang_luo 2003-10-20
  • 打赏
  • 举报
回复
你是贴过去的?????我上面回复的那个括号打错了
<% neirong=replace(rst("content"),chr(13),"<BR>")
neirong=replace(neirong,chr(32)," ")
%>
然后方法和我上面说的一样,肯定没错的
相信我!!!!
avonqin 2003-10-20
  • 打赏
  • 举报
回复
我不能上qq的哦,嘿嘿~~
maomao093152 2003-10-20
  • 打赏
  • 举报
回复
李文,你在吗?我的QQ是284202817,你可以在QQ里找到我。
avonqin 2003-10-20
  • 打赏
  • 举报
回复
#
form1.action="?city="+id;
form1.submit();
改为:
window.location.href="?city="+id;
##
sql2="select .paretid,……" 错了吧!
###
所有request.Form("city")改为:request("city")


BABY818 2003-10-20
  • 打赏
  • 举报
回复
李文。改啦。第二个没有出现值。对啦,刚才我给的那个不是上次改的。要上次的吗?我帖出来。

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>


<%citycode=request.Form("city")
%>
<%set conn=Server.CreateObject("ADODB.Connection")
StrCnn = "Provider=SQLOLEDB;Server=ahui;UID=sa;PWD=;Database=enterprise"
conn.open strcnn

sql1="select * from tb_city order by cityid"

if trim(request.Form("city"))<>"" then
sql2="select .paretid,tb_area2.area2name,tb_area2.area2id from tb_area2 ,tb_city where tb_area2.paretid='"&trim(request.Form("city"))&"'"
'tb_area2.paretid='"&trim(request.Form("city"))&"'"
else
sql2="select tb_city.citycode,tb_area2.paretid,tb_area2.area2name,tb_area2.area2id from tb_area2 ,tb_city "
end if

Set rs1= Server.CreateObject("ADODB.Recordset")
rs1.open sql1,conn,1,1
Set rs2= Server.CreateObject("ADODB.Recordset")
rs2.open sql2,conn,1,1
%>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>










<body>
<form name=form1 style="margin:0;" method="post" action="results1.asp">

<select name=city onchange="location.href='?city='+form1.city.options[form1.city.selectedIndex].value;">


<%

if rs1.RecordCount >0 then
while not rs1.eof

Response.Write"<option value="&rs1("citycode")&">"&rs1("cityname")&"</option>"
'citycode=request.Form("city")
if request.form("city")=rs1("citycode") then
response.Write("selected")
end if
rs1.movenext
wend
Else

Response.Write "没有配置"

end if

%>

</select>
<select name=area2 onChange="ChangeLocationi(form1.area2.options[form1.area2.selectedIndex].value);">

<option value=""<%response.Write("selected")%>></option>
<%

if rs2.RecordCount<0 then

response.write "<option value="""">库中没有部门!</option>"

else

while not rs2.eof

response.write "<option value="&rs2("paretid")&">" &rs2("area2name")&"</option>"

rs2.movenext

wend

end if

%>
</select>
<input type="submit" name="Submit" value="提交">
</form>
<%rs1.close

set rs1 = nothing

rs2.close

set rs2 = nothing%>

</body>
</html>
avonqin 2003-10-20
  • 打赏
  • 举报
回复
form1.action="?city="+id;
form1.submit();
改为:
window.location.href="?city="+id
fish699 2003-10-20
  • 打赏
  • 举报
回复
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
StrCnn = "Provider=SQLOLEDB;Server=ahui;UID=sa;PWD=;Database=enterprise"
conn.open strcnn
'/////接收从url上传递过来的值
citycode=request("city")

sql1="select * from tb_city order by cityid"
'/////如果有值那么定义第一个数据集
if citycode<>"" then
sql2="select tb_city.citycode,tb_area2.paretid,tb_area2.area2name,tb_area2.area2id from tb_area2 ,tb_city where tb_area2.paretid='"&citycode&"'"
Set rs2= Server.CreateObject("ADODB.Recordset")
rs2.open sql2,conn,1,1
end if


Set rs1= Server.CreateObject("ADODB.Recordset")
rs1.open sql1,conn,1,1


%>
<script language=javascript>
fnChangeLocation(id){
/////////////////////如果点击第一个city select控件,那么调用此函数,并提交本页面,传递的值为选择的值
///////////如果action不对,那么请自己重写
form1.action="?city="+id;
form1.submit();
}
</script>
<body>
<form name=form1 style="margin:0;" method="post" >
<select name=city onchange="fnChangeLocation(form1.city.options[form1.city.selectedIndex].value)">
<%
if rs1.RecordCount >0 then
while not rs1.eof
Response.Write"<option value="&trim(rs1("citycode"))
if citycode=trim(rs1("citycode")) then
'//////////如果和传递过来的值相等,那么选中此控件的选择值
response.Write("selected")
end if
response.Write ">"&rs1("cityname")&"</option>"
rs1.movenext
wend
Else
Response.Write "<option value="""">没有配置</option>"
end if
%>
</select>
<select name=area2>
<option value="">-------------</option>
<%
if sql2<>"" then
'/////////如果有参数传递,那么出现控件的值
if rs2.RecordCount<=0 then
response.write "<option value="""">库中没有部门!</option>"
else
while not rs2.eof
response.write "<option value="&rs2("paretid")&">" &rs2("area2name")&"</option>"
rs2.movenext
wend
end if
end if
%>
</select>
</form>
<%
rs1.close
set rs1 = nothing

if sql2<>"" then
rs2.close
set rs2 = nothing
end if

conn.Close
Response.End
%>


</body>
</html>
avonqin 2003-10-20
  • 打赏
  • 举报
回复
被你气死了!!!!!!!!111
maomao093152 2003-10-20
  • 打赏
  • 举报
回复
李文呀,现在我做了一个显示页面,发现第一个参数穿过去啦。但是不见第二个
maomao093152 2003-10-20
  • 打赏
  • 举报
回复
凝狐,好啦。没有错。成功拉
maomao093152 2003-10-20
  • 打赏
  • 举报
回复
凝狐,原来是在显示也面加的呀。我明白啦。等一下呀
avonqin 2003-10-18
  • 打赏
  • 举报
回复
有鬼啦~~~~

把整页代码给大家看看可以么???
fish699 2003-10-18
  • 打赏
  • 举报
回复
没有错,只有city的传过去拉
fish699 2003-10-18
  • 打赏
  • 举报
回复
诶呀。我知道你的意思啦,李文,现在是citycode是可以传过去。没有错拉。你等一下,我把处理页面看一下呀
fish699 2003-10-18
  • 打赏
  • 举报
回复
初学者的tmpStr = Server.HTMLEncode(innerHTMLStr)好像有错
加载更多回复(43)

28,390

社区成员

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

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