function c(Tstr,Word) Dim re Set re = new RegExp re.IgnoreCase =True re.Global=True re.pattern = "("&Word&")" c=re.replace(Tstr,"<font style='color:red;'>$1</font>") End function
調(diào)用方法
response.write c("內(nèi)容字串","要顯示為紅色的字")
比如
<% function c(Tstr,Word) Dim re Set re = new RegExp re.IgnoreCase =True re.Global=True re.pattern = "("&Word&")" c=re.replace(Tstr,"<font style='color:red;'>$1</font>") End function Response.write("lamking.com","a") %> 就把lamking.com中的a替換為紅色的。