UEditor解决设置文本不成功问题

   

 var count = 0;

        var cutEditor;
        var edit;
        var typeid;
        var categoryid;


        $(function () {
            cutEditor = UE.getEditor('editorCut');
            edit = UE.getEditor('editor');
            // alert();
            var vNewsID = $("#hideID").val();


             获取新闻对应条目信息


            $.getJSON("/News/ShowNews", { ContentID: vNewsID }, function (data) {


                var list = eval(data);
                var vContent;
                var vCutContent;
                $.each(list, function (i, val) {


                    if (i == 'Content') { //text
                        vContent = val;
                    }
                    if (i == 'Title')//title
                    {
                        //  alert(val);
                        $("#newstitle").val(val);
                    }


                    if (i == 'NewsCategoryID')//typeID
                    {
                        //   alert(val+'fdfdfd');
                        categoryid = val;


                        //  $("#newstype").val(val);


                    }
                    if (i == 'NewsContentRemark')//cut
                    {
                        vCutContent = val;


                    }


                    if (i == 'TypeID')//typeID
                    {
                        typeid = val;
                    }
                    if (i == 'FoundDate') {
                        $("#foundDate").val((eval(val.replace(/\/Date\((\d+)\)\//gi, "new Date($1)"))).pattern("yyyy-MM-dd hh:mm:ss"));
                    }
                });


                //获取新闻类型列表


                //UE.getEditor('editorCut');
                //UE.getEditor('editor');
                $.getJSON("/News/GetNewsTypeList", {}, function (data) {
                    var list = eval(data);


                    $.each(list, function (i, val) {
                        $.each(val, function (j, arr) {
                            if (j >= 0 && arr.Id != undefined) {
                                if (arr.TypeID == typeid) {
                                    $("#newstype").append("<option value='" + arr.Id + "'>" + arr.Name + "</option>");
                                }


                            }


                        });
                    });
                    //  alert(categoryid);
                    $("#newstype").val(categoryid);
                });




                edit.addListener("ready", function () {
                    edit.setContent(vContent);
                    count = count++;
                });
                cutEditor.addListener("ready", function () {
                    cutEditor.setContent(vCutContent);
                    count = count++;
                });




                if (count == 0) {
                    edit.setContent(vContent);
                    cutEditor.setContent(vCutContent);
                }










            });


            //






        });
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值