找回密碼
 註冊
搜索
查看: 8224|回復: 0

留言板 留言換行問題 (寫入資料庫及顯示)

[複製鏈接]
發表於 2006-9-14 18:28:10 | 顯示全部樓層 |閱讀模式
以下為ASP代碼:
  1. BoardMessage = Trim(Request.form("MESSAGE"))
  2. '將 < 及 > 等控制碼改成字元
  3. BoardMessage=Replace(BoardMessage,"<","&lt")
  4. BoardMessage=Replace(BoardMessage,">","&gt")
  5. ' 主要是將vbCrlf換成<BR>寫入Database
  6. BoardMessage=Replace(BoardMessage,vbCrlf,"<BR>")
  7. '將 <!-- 及 <script script>等程式碼改成字元
  8. BoardMessage=Replace(BoardMessage,"<!--","&lt!--")
  9. BoardMessage=Replace(BoardMessage,"<script","&ltscript")
  10. BoardMessage=Replace(BoardMessage,"script>","script&gt")
複製代碼
您需要登錄後才可以回帖 登錄 | 註冊

本版積分規則

Archiver|手機版|彩色筆小沛的知識庫

GMT+8, 2024-12-22 09:57 , Processed in 0.015844 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回復 返回頂部 返回列表