JDP 發表於 2006-9-14 18:28:10

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

以下為ASP代碼:

BoardMessage = Trim(Request.form("MESSAGE"))
'將 < 及 > 等控制碼改成字元
BoardMessage=Replace(BoardMessage,"<","&lt")
BoardMessage=Replace(BoardMessage,">","&gt")
' 主要是將vbCrlf換成<BR>寫入Database
BoardMessage=Replace(BoardMessage,vbCrlf,"<BR>")
'將 <!-- 及 <script script>等程式碼改成字元
BoardMessage=Replace(BoardMessage,"<!--","&lt!--")
BoardMessage=Replace(BoardMessage,"<script","&ltscript")
BoardMessage=Replace(BoardMessage,"script>","script&gt")
頁: [1]
查看完整版本: 留言板 留言換行問題 (寫入資料庫及顯示)