帝国CMS 给简介字段添加一键排版按钮
帝国CMS后台-》管理数据表-》选择数据表》打开smalltext字段
输入表单替换html代码 添加如下代码:
<script> function format() { var body = "\n"+document.getElementById("smalltext").value; body = body.replace(/ | /ig,""); body = body.replace(/\n/ig," "); body = body.replace("\n\n",""); body = body.replace(/ | /ig,""); body = body.replace(/\r\n/ig,"\n"); body = body.replace(/\n\n/ig,"\n"); body = body.replace(/\n\n/ig,"\n"); body = body.replace(/\n\n/ig,"\n"); body = body.replace(/\n\n/ig,"\n"); body = body.replace(/\n/ig," \n"); body = body.replace("\n\n","\n"); body = body.replace(/ | /ig,""); body = body.replace(/\r\n/ig,"\n"); body = body.replace(/\n\n/ig,"\n"); body = body.replace(/\n\n/ig,"\n"); body = body.replace(/\n\n/ig,"\n"); body = body.replace(/\n\n/ig,"\n"); body = body.replace(/\n/ig,"\n\n"); body = body.replace("\n\n",""); document.getElementById("smalltext").value=body; } </script> <textarea name="smalltext" cols="80" rows="10" id="smalltext"><?=$ecmsfirstpost==1?"":ehtmlspecialchars(stripSlashes($r[smalltext]))?></textarea> <input type="button" value="自动排版" name="body" onClick="javascript:format()" >