zoukankan      html  css  js  c++  java
  • asp.net mvc3 使用FckEditor 编辑内容

     

       在 razor 中 使用Fckeditor 编辑内容,需要引入js

        

    <script src="@Url.Content("~/fckeditor/fckeditor.js")" type="text/javascript"></script>

      

       至于html编码

       

              <tr>
                <td>内容</td>
                <td>
                    @Html.HiddenFor(model => model.Content)
                    <script type="text/javascript">
                        
    var f = new FCKeditor("FckContent""628""445");
                        f.Create();
                    
    </script>
                    @Html.ValidationMessageFor(model => model.Content, "", new { @class = "red" })
                </td>
              </tr>

      

        要把Content中的数据传到后台,需要在提交时间中把值赋予@Html.HiddenFor(model => model.Content)    

    <input type="image" src="/images/confirm.jpg" alt="确认" onclick="getEditorHTMLContents('FckContent')" />

       

        js 方法如下

       

    function getEditorHTMLContents(EditorName) {
            var otxt = FCKeditorAPI.GetInstance(EditorName).GetHTML(true);
            if (otxt == '' || otxt == null) {
                return false;
            }
            else {
                $('input[id$="Content"]').val(otxt);
                return true;
            }
        }

        这样后台中传入的model中包含Content

        实现数据操作。

          

  • 相关阅读:
    poj2954
    bzoj1863
    bzoj2002
    bzoj1389
    [POJ3041] Asteroids(最小点覆盖-匈牙利算法)
    [POJ2594] Treasure Exploration(最小路径覆盖-传递闭包 + 匈牙利算法)
    [POJ2446] Chessboard(二分图最大匹配-匈牙利算法)
    [luoguP1266] 速度限制(spfa)
    [luoguP1186] 玛丽卡(spfa)
    [luoguP1027] Car的旅行路线(Floyd)
  • 原文地址:https://www.cnblogs.com/lpe110/p/2387154.html
Copyright © 2011-2022 走看看