复制代码 代码如下:
html>
head>
/head>
body>
style>
#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;
}
/style>
span >格式化/span>
div contentEditable="true" id="x_edit" style='position:relative;line-height:13px;background-color:#f0f0f0;filter:Chroma(color=#FDFEFF);width:540px;height:320px;overflow:auto;white-space: nowrap; z-index: 2;border:0px'>
P>lt;htmlgt;BR>lt;headgt;BR>lt;/headgt;BR>lt;bodygt;BR>lt;stylegt;BR>#x_edit,#x_edit1{BR>nbsp; height:320px;BR>nbsp; width:540px;BR>nbsp; border:1px solid #666666;/P>
P>nbsp; color:red;/P>
P>nbsp; filter:chroma(color="#0f0f0f");BR>nbsp; background-color:#f0f0f0;BR>nbsp; font-family:verdana;BR>nbsp; font-size:11px;BR>nbsp; line-height:13px;BR>nbsp; margin-left:16px;BR>nbsp; overflow:scroll;BR>nbsp; border-left:none;BR>nbsp; scrollbar-arrow-color:#666666;BR>nbsp; scrollbar-base-color:#666666;BR>nbsp; scrollbar-darkshadow-color:#f0f0f0;BR>nbsp; scrollbar-face-color:#f0f0f0;BR>nbsp; }BR>lt;/stylegt;BR>lt;span );BR>nbsp;nbsp;nbsp; return str;BR>}BR>lt;/scriptgt;BR>lt;/bodygt;BR>lt;/htmlgt;/P>
/div>
script>
function abc(){
var s=x_edit.innerText;
s=s.replace(/\/?(\w+[\s\S]*?)>/gi,function(a){return a.replace(/[\r\n]/gi,"")});
x_edit.innerText=s;
}
/script>
/body>
/html>
您可能感兴趣的文章:- php过滤HTML标签、属性等汇总
- asp自动补全html标签自动闭合()
- asp.net删除指定的HTML标签的代码
- Java/Js下使用匹配嵌套Html标签
- 移除HTML标签的
- 请教一个,匹配所有Html标签外部的指定字符串
- 使用去除所有html标签只保留文字