婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > 用正則表達式格式化html標簽的代碼

用正則表達式格式化html標簽的代碼

熱門標簽:廣西智能外呼系統多少錢 大學校門地圖標注 荊州智能電銷機器人 銷售電銷機器人詐騙 地圖標注與公司業務關系 外呼系統api對接 提高電話機器人接通率 平涼高德地圖標注商戶要收費嗎 福建微碼電話機器人
復制代碼 代碼如下:

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 onclick="abc()">格式化/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 onclick="abc()"gt;試試獲得selection的top,然后加上div的scrollTop,然后除以行高lt;/spangt;BR>lt;span id="a" onclick="alert('a')"gt;alt;/spangt;BR>lt;span id="b" onclick="alert('b')"gt;blt;/spangt;BR>lt;span id="c" onclick="alert('c')"BR>gt;clt;/spangt;BR>lt;span id="d" onclick="alert('d')"gt;dlt;/spangt;BR>lt;span id="e" onclick="alert('e')"gt;elt;/spangt;BR>lt;span id="f" onclick="alert('f')"gt;flt;/spanBR>gt;BR>lt;span id="g"BR>nbsp;onclick="alert('g')"gt;glt;/spangt;BR>lt;textarea id="x_edit" wrap=offgt;lt;/textareagt;BR>lt;div contentEditable="true" id="x_edit1" 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'gt;lt;/divgt;BR>lt;scriptgt;BR>function abc(){BR>nbsp;nbsp;nbsp; //s=x_edit1.innerText;BR>nbsp;nbsp;nbsp; var s=x_edit.value;BR>nbsp;nbsp;nbsp; s=s.replace(/\n/gi,"");BR>nbsp;nbsp;nbsp; //s=s.replace(/lt;(\w+)(.*?)[^lt;gt;]gt;/gi,"lt;"+aaa("$1$2")+"gt;");BR>nbsp;nbsp;nbsp; s=s.replace(/lt;(.*?)[^lt;gt;]gt;/gi,"lt;"+aaa("$1")+"gt;");BR>nbsp;nbsp;nbsp; s=s.replace(/\n/gi,"@");BR>nbsp;nbsp;nbsp; //var LineValue=x_edit1.innerText.split("\r")BR>nbsp;nbsp;nbsp; /*var LineValue=x_edit.value.split("\r")BR>for(var i=0;ilt;LineValue.length;i++){BR>nbsp;nbsp;nbsp; LineValue[i]=LineValue[i].replace(/(".*")/gi,"$1".replace(/lt;/gi,"\xef").replace(/gt;/gi,"\xff"))BR>nbsp;nbsp;nbsp; LineValue[i]=LineValue[i].replace(/lt;(.*[^lt;gt;])gt;/gi,"lt;"+"$1"+"gt;\r")BR>nbsp;nbsp;nbsp; LineValue[i]=LineValue[i].replace(/\r\r/gi,"\r")BR>nbsp;nbsp;nbsp; LineValue[i]=LineValue[i].replace(/(".*")/gi,"$1".replace(/\xef/gi,"lt;").replace(/\xff/gi,"gt;"))BR>}*/BR>nbsp;nbsp;nbsp; //x_edit1.innerText=LineValue.join("");BR>nbsp;nbsp;nbsp; //x_edit.value=LineValue.join("");BR>nbsp;nbsp;nbsp; x_edit.value=s;BR>nbsp;nbsp;nbsp; //x_edit1.innerText=s;BR>}BR>function aaa(str){BR>nbsp;nbsp;nbsp; str=str.replace(/\r/gi," ");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標簽只保留文字

標簽:黔東 邯鄲 衡陽 內江 婁底 海南 樂山 德陽

巨人網絡通訊聲明:本文標題《用正則表達式格式化html標簽的代碼》,本文關鍵詞  用,正則,表達式,格式化,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《用正則表達式格式化html標簽的代碼》相關的同類信息!
  • 本頁收集關于用正則表達式格式化html標簽的代碼的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 徐州市| 平定县| 辉南县| 景东| 怀柔区| 石狮市| 浏阳市| 舒城县| 翼城县| 太原市| 卓资县| 基隆市| 民权县| 桐柏县| 贵定县| 长泰县| 陆河县| 门源| 方正县| 金溪县| 泰安市| 蒙城县| 岳阳县| 荆州市| 金昌市| 九龙县| 资中县| 兴国县| 介休市| 哈巴河县| 北京市| 垦利县| 沛县| 江门市| 额敏县| 南昌市| 旌德县| 务川| 兰溪市| 东明县| 奉化市|