帝国CMS 给简介字段添加一键排版按钮

时间:2024年04月02日

/

来源:网络

/

编辑:佚名

帝国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()" >
复制代码
猜你需要

豫ICP备2021026617号-1  豫公网安备:41172602000185   Copyright © 2021-2028 www.78moban.com/ All Rights Reserved

本站作品均来自互联网,转载目的在于传递更多信息,并不代表本站赞同其观点和对其真实性负责。如有侵犯您的版权,请联系 1565229909#qq.com(把#改成@),我们将立即处理。