<div class="codetitle"> <span><a style="CURSOR: pointer" data="46703" class="copybut" id="copybut46703" onclick="doCopy('code46703')"><u>复制代幣</u></a></span>代码如下:</div> <div class="codebody" id="code46703"> <br><script type="text/javascript"> <br>// HTML タグを閉じる -------------------------------------- -- <br>function closeHTML(str){ <br>var arrTags=["span","font","b","u","i","h1","h2","h3", "h4","h5","h6","p","li","ul","table","div"]; <br>for(var i=0;i<arrtags.length>var intOpen=0; <br>var intClose=0; <br>var re=new RegExp("\var arrMatch=str.match(re); <br>if(arrMatch!=null) intOpen=arrMatch.length; <br>re=new RegExp("\","ig"); <br>arrMatch=str.match(re); <br>if(arrMatch!=null) intClose=arrMatch.length; <br>for(var j=0;j<intopen-intclose>str ="</" arrTags[i] ">"; <br>} <br>/*for(var j=(intOpen-intClose-1);j>=0;j--){ <br>str ="</" arrTags[i] ">" ; <br>}*/ <br>} <br>文字列を返します。 <br>} <br></script> <br></intopen-intclose></arrtags.length> </div>