国产探花免费观看_亚洲丰满少妇自慰呻吟_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("字段名"))%>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 宁津县| 墨江| 巴彦淖尔市| 富顺县| 宁城县| 荣成市| 内丘县| 苏州市| 兴隆县| 安溪县| 绥芬河市| 寿阳县| 宁武县| 延安市| 彭水| 庆阳市| 正镶白旗| 大港区| 马尔康县| 老河口市| 兴隆县| 东港市| 汽车| 新蔡县| 恭城| 彩票| 永清县| 堆龙德庆县| 通河县| 射阳县| 西藏| 长沙县| 永登县| 永平县| 抚州市| 蒲城县| 玛沁县| 花莲县| 花莲县| 定日县| 彝良县|