国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

將多行區域表單中的內容換成html代碼

2024-05-04 11:05:49
字體:
來源:轉載
供稿:網友
開始將多行區域表單中的內容沒有處理,就直接保存起來,然后在顯示的時候發現,明明保存的時候有換行等格式,但是顯示不出來,所有的內容都在一行上。原因是沒有將多行區域表單中的內容換成html格式引起這個原因的。
<%
Function inHTML(str) '將表單中的內容換成html格式,用于將表單中內容寫入數據庫
Dim sTemp
sTemp = str
inHTML = ""
If IsNull(sTemp) = True Then
Exit Function
End If
stemp=Replace(stemp, CHR(38), "&")
sTemp = Replace(sTemp, "&", "&amp;")
sTemp = Replace(sTemp, "<", "&lt;")
sTemp = Replace(sTemp, ">", ">")
stemp=Replace(stemp, CHR(39), "'")
stemp= Replace(stemp, CHR(32), " ")
sTemp = Replace(sTemp, Chr(34), """)
stemp = Replace(stemp, CHR(13), "")
    stemp = Replace(stemp, CHR(10), "
")
inHTML = sTemp
End Function

Function outHTML(str) '將html格式顯示出多行區域表單中,用于修改表單中的內容。
Dim sTemp
sTemp = str
outHTML = ""
If IsNull(sTemp) = True Then
Exit Function
End If  
stemp=replace(stemp,"
",chr(10))
stemp=replace(stemp,"",chr(13))
stemp=replace(stemp,""",chr(34))
stemp=replace(stemp," ",chr(32))
stemp=replace(stemp,"'",chr(39))
stemp=replace(stemp,">",">")
stemp=replace(stemp,"&lt;","<")
stemp=replace(stemp,"&amp;","&")
stemp=replace(stemp,"&",chr(38))
outHTML = sTemp
End Function
%>
用法:
 text=inhtml(request("textarea"))'這樣就將textarea中的內容轉換成了html代碼
 當顯示數據庫中這個內容到多行表單方法
 <textarea name="textarea" cols="30" rows="30"><%=outhtml(rs("字段名"))%>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 张家港市| 中江县| 新晃| 灯塔市| 镇平县| 贺州市| 崇礼县| 四平市| 西和县| 承德市| 乌拉特后旗| 达州市| 龙口市| 胶州市| 垫江县| 马尔康县| 睢宁县| 鄂温| 浦城县| 祥云县| 苍山县| 沙田区| 玉树县| 绥阳县| 大足县| 建水县| 新晃| 大同县| 怀宁县| 巫山县| 乌兰浩特市| 南通市| 南部县| 新晃| 漾濞| 阿拉善右旗| 黑龙江省| 娄烦县| 连云港市| 桂阳县| 乌海市|