以下是代码片段: <% ’ ============================================ ’ 把字符串进行HTML解码,替换server.htmlencode ’ 去除Html格式,用于显示输出 ’ ============================================ Function outHTML(str) Dim sTemp sTemp = str outHTML = "" If IsNull(sTemp) = True Then Exit Function End If sTemp = Replace(sTemp, "&", "&") sTemp = Replace(sTemp, "<", "<") sTemp = Replace(sTemp, ">", ">") sTemp = Replace(sTemp, Chr(34), """) sTemp = Replace(sTemp, Chr(10), "<br>") outHTML = sTemp End Function ’ ============================================ ’ 去除Html格式,用于从数据库中取出值填入输入框时 ’ 注意:value="?"这边一定要用双引号 ’ ============================================ Function inHTML(str) Dim sTemp sTemp = str inHTML = "" If IsNull(sTemp) = True Then Exit Function End If sTemp = Replace(sTemp, "&", "&") sTemp = Replace(sTemp, "<", "<") sTemp = Replace(sTemp, ">", ">") sTemp = Replace(sTemp, Chr(34), """) inHTML = sTemp End Function %> |
新闻热点
疑难解答