一只超 2020-01-12 16:31 采纳率: 0%
浏览 1304

JS换行保存后,不显示换行,显示的却是字符<br>

图片说明
缺陷内容保存后可以换行显示,处理结果就不可以,就显示

function getAdd() {
    var w=$(window).width();
    var h=$(window).height();
    $('#dd').dialog({
        title: '添加缺陷记录',
        width: w * .6,
        height: h - 136,
        closed: false,
        cache: false,
        href: 'dia/log/defect-record/get-add.html?module_id=' + module_id + '&station_info=' + station_info,
        modal: true,
        buttons: [{
            text: '保存',
            iconCls: "easy-icon-save",
            handler: function () {
                var shift = $("#reportShift").combobox("getValue");
                if(shift == -1 || shift == ""){
                    $.messager.alert('操作', '请重新核对缺陷上报日期以及所选班次');
                    return false;
                }
                checkStation("station");//检测是否选择或输入
                var defectLevel = $('#defectLevel').combobox('getValue');
                if (defectLevel == 0 || defectLevel == 1) {
                    var planTime = $('#planProTime').datebox('getValue');
                    if (planTime == null || planTime == '') {
                        $.messager.alert("修改", "计划处理时间不能为空!", "error");
                        return;
                    }
                }
                var data = $("#defect-add-form").serialize();
                // var content = $('#content').val().replace(/\n/g,"<br/>");
                $.ajax({
                    url: "dia/log/defect-record/insert.do?module_id=" + module_id + '&proResult=' + $('#proResult').val().replace(/\r\n/g, '<br/>').replace(/\n/g, '<br/>').replace(/\s/g, ' '),
                    type : "post",
                    dataType : "json",
                    data : data,
                    success : function(request) {
                        if(request.success){
                            query();
                        }
                        $.messager.show({
                            title: '操作提示',
                            msg: request.msg,
                            timeout: 2000,
                            sshowType: 'slide'
                        });
                    }
                });

                $("#dd").dialog({
                    closed: true
                });
            }
        }, {
            text: '关闭',
            iconCls: "easy-icon-cancel",
            handler: function () {
                $("#dd").dialog({
                    closed: true
                });
            }
        }],
        //用于图形化,窗口打开完成后,给厂站赋值
        onLoad: function () {
            var indexDevId = $("#indexDevId").val();
            $('#station').combobox('setValue', indexDevId);
        }
    });
}

这是JSP代码

            <tr>
                <td class="td-inputtitle" style="text-align: center">处理结果</td>
                <td class="td-input" colspan="5" >
                    <c:forEach var="item" items="${historyProcess }">
                        <c:if test="${item.proResult!=null && item.proResult!='' }">
                            <div class="history_process">
                                <div class="user_info">${item.userName }<br/>${item.time }</div>
                                <div class="content" >${fn:replace(item.proResult,vEnter,'<br>') } </div>
                                <div class="clearfix"></div>
                            </div>
                        </c:if>
                    </c:forEach>
                    <textarea type="text" rows="6" name="proResult" id="proResult"
                              style="width:95%;"> ${currProcess.proResult } </textarea>
                </td>
            </tr>
  • 写回答

1条回答 默认 最新

  • 崽崽的谷雨 2020-01-13 08:50
    关注

    你渲染的时候可以用innerHtml试试,把html字符串转成html

    评论

报告相同问题?

悬赏问题

  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮