怎样才能清除所指定字段中的中的html样式!急!急!急!
<p ><%#Eval("EDescription").ToString().Length > 500 ? Eval("EDescription").ToString().Substring(0, 497) + "..." : Eval("EDescription").ToString()%>
</p>在前台去除字段“EDescription”含的Html格式
<p ><%#Eval("EDescription").ToString().Length > 500 ? Eval("EDescription").ToString().Substring(0, 497) + "..." : Eval("EDescription").ToString()%>
</p>在前台去除字段“EDescription”含的Html格式
{
return Regex.Replace(strHtml, "<[^>]*>", "");
}
只是<%#Eval("EDescription").ToString().Length > 500 ? Eval("EDescription").ToString().Substring(0, 497) + "..." : Eval("EDescription").ToString()%>
desc = Regex.Replace(desc, @"<.+?>", "");
if(desc.Length>500) desc = desc.SubString(0,500);
return desc;
}<%# GetDesc(Eval("EDescription").ToString()) %>
<head>
<script>
function show(){
alert(document.getElementById("tb").innerText);
alert(document.getElementById("sp").innerText);
}
</script>
</head>
<body>
<table id='tb'><tr><td>innerText2</td></tr></table>
<input type="button" id="btn" value="Show innerText" onclick="show()">
<span id='sp'>测试代码测试测试啊<span>
</body>
</html>