16,552
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="zh-cn">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
</head>
<style>
/* 浮动列表==================================================== */
tr>td>div>ul{
position: fixed;
top: 0px;
left: 0px;
}
/* 列表样式=================================================== */
*{ margin:0px; padding:0px; font-size:22px; }
#menu{ width:160px; border:1px solid #ccc;}
#menu ul{ list-style:none;}
#menu ul li{ height:28px; line-height:28px; background:#FFCCFF; border-bottom:1px solid #333333; padding:0px 8px;position:relative;}
#menu ul li:hover ul{ display:block;}
#menu ul li ul{ display:none;position: absolute; left: 100px; top: 0px;width:100px; border:1px solid #ccc; border-bottom:none;}
a{color: #000000;text-decoration: none;}
a:hover{ color:blue;background:red;}
/* a:hover{ color:#00FFFF;} */
#第一列{
text-align:center
}
#第二列{
text-align:right
}
#第三列{
text-indent:40px
}
#第四列{
text-indent:40px
}
#第五列{
text-indent:40px
}
div{
max-width:1000px;
width:auto;
min-height:20px;
padding:3px;
line-height:30px;
word-wrap:break-word;
overflow-x:hidden;
overflow-y:auto;
font-family:仿宋;
color:blue;
font-size:20px;
margin:2px auto;
}
.border{
border: 1px solid #FF0000;
}
/* 列表项背景色跟随焦点div变化==================================== */
.listyle{
background-color:blue;
width:100px;
}
/* =============================================================== */
</style>
<body>
<table border=1 width="100%">
<tr>
<td width="160px"
bgcolor="skyblue"
valign="top"
line-height:20px;
>
<div id="menu">
<ul>
<li><a href="2.html#第一列">第一列</a></li>
<li><a href="2.html#第二列">第二列</a></li>
<li><a href="2.html#第三列">第三列</a></li>
<li><a href="2.html#第四列">第四列</a></li>
<li><a href="2.html#第五列">第五列</a></li>
</ul>
</td><td>
<div ID="第一列" contenteditable="true" onblur="setBlur(this,'第一列-表A-窗口A')" onfocus="setFocus(this,'第一列-表A');">绑定表A第一列</div>
<div ID="第二列" contenteditable="true" onblur="setBlur(this,'第二列-表A-窗口A')" onfocus="setFocus(this,'第二列-表A');">绑定表A第二列</div>
<div ID="第三列" contenteditable="true" onblur="setBlur(this,'第三列-表A-窗口A')" onfocus="setFocus(this,'第三列-表A');">绑定表A第三列</div>
<div ID="第四列" contenteditable="true" onblur="setBlur(this,'第四列-表A-窗口A')" onfocus="setFocus(this,'第四列-表A');">绑定表A第四列</div>
<div ID="第五列" contenteditable="true" onblur="setBlur(this,'第五列-表A-窗口A')" onfocus="setFocus(this,'第五列-表A');">绑定表A第五列</div>
</td></tr></table>
</body>
<script>
/* 列表项背景色跟随焦点div变化============================================ */
function setClick(num){
var theNumber=parseInt(num)-1;
var liList=document.getElementsByTagName("li");
var listLength=liList.length;
for(var i=0;i<listLength;i++){
liList[i].className="";
}
liList[theNumber].className="listyle";
}
/* ======================================================================== */
function setFocus(obj,str2) {
obj.setAttribute("class", "border");
window.external.setPosition(str2);
}
function setBlur(obj, str2) {
obj.setAttribute("class", "");
window.external.setCurrentValue(obj.innerHTML, str2);
}
function init(s1, s2, s3, s4, s5) {
document.getElementById("第一列").innerHTML = s1.replace(/\r\n/g,"<p>");
document.getElementById("第二列").innerHTML = s2.replace(/\r\n/g,"<p>");
document.getElementById("第三列").innerHTML = s3.replace(/\r\n/g,"<p>");
document.getElementById("第四列").innerHTML = s4.replace(/\r\n/g,"<p>");
document.getElementById("第五列").innerHTML = s5.replace(/\r\n/g,"<p>");
}
function setElementFocus(name) {
var obj = document.getElementById(name);
if(obj != null) {
obj.focus();
setFocus(obj);
location.href = "#" + name;
}
}
</script>
</html>
Imports System.Text.RegularExpressions
Module Module1
Sub Main()
Dim test As String = "<div>我是格式字符串</div>"
Console.WriteLine(CheckHtml(test))
End Sub
''' <summary>
''' 去除HTML标记
''' </summary>
''' <param name="str">包括HTML的源码 </param>
''' <returns>已经去除后的文字</returns>
Public Function CheckHtml(ByVal str As String) As String
'删除脚本
str = Regex.Replace(str, "<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase)
'删除HTML
str = Regex.Replace(str, "<(.[^>]*)>", "", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "([\r\n])[\s]+", "", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "-->", "", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "<!--.*", "", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "&(quot|#34);", """", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "&(amp|#38);", "&", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "&(lt|#60);", "<", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "&(gt|#62);", ">", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "&(nbsp|#160);", " ", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "&(iexcl|#161);", "¡", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "&(cent|#162);", "¢", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "&(pound|#163);", "£", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "&(copy|#169);", "©", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "&#(\d+);", "", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "…", "", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "—", "", RegexOptions.IgnoreCase)
str = Regex.Replace(str, "“", "", RegexOptions.IgnoreCase)
str.Replace("<", "")
str = Regex.Replace(str, "”", "", RegexOptions.IgnoreCase)
str.Replace(">", "")
str.Replace(vbCr & vbLf, "")
'Htmlstring = HttpContext.Current.Server.HtmlEncode(Htmlstring).Trim()
Return str
End Function
End Module