输入表单替换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()" >
复制代码
声明:有的资源均来自网络转载,版权归原作者所有,如有侵犯到您的权益 请联系邮箱:312334557@qq.com 我们将配合处理!
原文地址:《帝国CMS 给简介字段添加一键排版按钮》发布于2020-07-12 10:46:14