这样在js中就可以
docunment.getElementById("idFont").innerText = "星期二,星期三"
这样就可以实现你想要的功能
如果你用JQuery的话也可以这样 $(".cfrq").text("星期二,星期三")
asp用Server.HTMLEncode<%response.write(Server.HTMLEncode("The image tag: <img>"))%>
javascript 用正则表达式进行转换处理
var HtmlUtil = {
/*1.用正则表达式实现html转码*/
htmlEncodeByRegExp:function (str){
var s = ""
if(str.length == 0) return ""
s = str.replace(/&/g,"&")
s = s.replace(/</g,"<")
s = s.replace(/>/g,">")
s = s.replace(/ /g," ")
s = s.replace(/\'/g,"'")
s = s.replace(/\"/g,""")
return s
},
/*2.用正则表达式实现html解码*/
htmlDecodeByRegExp:function (str){
var s = ""
if(str.length == 0) return ""
s = str.replace(/&/g,"&")
s = s.replace(/</g,"<")
s = s.replace(/>/g,">")
s = s.replace(/ /g," ")
s = s.replace(/'/g,"\'")
s = s.replace(/"/g,"\"")
return s
}
}