用正则表达式格式化html标签的代码
本文导语: 代码如下: #x_edit{ height:320px; width:540px; border:1px solid #666666; color:red; filter:chroma(color="#0f0f0f"); background-color:#f0f0f0; font-family:verdana; font-size:11px; line-height:13px; margin-left:16px; overflow:scroll; border-l...
#x_edit{
height:320px;
width:540px;
border:1px solid #666666;
color:red;
filter:chroma(color="#0f0f0f");
background-color:#f0f0f0;
font-family:verdana;
font-size:11px;
line-height:13px;
margin-left:16px;
overflow:scroll;
border-left:none;
scrollbar-arrow-color:#666666;
scrollbar-base-color:#666666;
scrollbar-darkshadow-color:#f0f0f0;
scrollbar-face-color:#f0f0f0;
}
格式化
#x_edit,#x_edit1{
height:320px;
width:540px;
border:1px solid #666666;
color:red;
filter:chroma(color="#0f0f0f");
background-color:#f0f0f0;
font-family:verdana;
font-size:11px;
line-height:13px;
margin-left:16px;
overflow:scroll;
border-left:none;
scrollbar-arrow-color:#666666;
scrollbar-base-color:#666666;
scrollbar-darkshadow-color:#f0f0f0;
scrollbar-face-color:#f0f0f0;
}
试试获得selection的top,然后加上div的scrollTop,然后除以行高
a
b
c
d
e
f
g
function abc(){
//s=x_edit1.innerText;
var s=x_edit.value;
s=s.replace(/n/gi,"");
//s=s.replace(//gi,"");
s=s.replace(//gi,"");
s=s.replace(/n/gi,"@");
//var LineValue=x_edit1.innerText.split("r")
/*var LineValue=x_edit.value.split("r")
for(var i=0;i