隨筆 - 9  文章 - 4  trackbacks - 0
          <2011年9月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          2345678

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          //取fck內容的長度
          function GetLength(str)
          {
              var oEditor = FCKeditorAPI.GetInstance(str) ;
              var checkContent= oEditor.EditorDocument ;
              var contentLength ;

              if ( document.all )       
              {
                  contentLength= checkContent.body.innerText.trim().length ;
              }
              else                   
              {
                  var r = checkContent.createRange() ;
                  r.selectNodeContents( checkContent.body ) ;
                  contentLength= r.toString().trim().length ;
              }
          return contentLength
          }  

          //判斷是不是為空
          function CheckPost(){
              if(GetLength("content")<=0)    //content為FCKeditor在頁面所設的名字
              {
                  alert('請輸入內容');       
                  return false;
              }
          }

          //取fck內容
          function GetContent(str)
          {
               var oEditor = FCKeditorAPI.GetInstance(str) ;
               return oEditor.GetXHTML();
          }  

          //去掉字符串的空格
          String.prototype.trim = function()
          {
                       return this.replace(/(^[\s]*)|([\s]*$)/g, "");
          }
          posted on 2009-07-23 19:37 田園風光 閱讀(1235) 評論(1)  編輯  收藏

          FeedBack:
          # re: 用js獲取FCKeditor的內容和判斷內容是否為空 2011-09-24 11:12 sdfgsdfgsd
          sdfgsdfgs  回復  更多評論
            

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 买车| 新邵县| 郧西县| 应用必备| 鄂托克前旗| 寿光市| 沙河市| 墨竹工卡县| 郓城县| 大方县| 沙田区| 黑龙江省| 邹城市| 岑巩县| 祁连县| 任丘市| 海伦市| 濮阳市| 邹城市| 乐平市| 福鼎市| 瑞安市| 建昌县| 怀柔区| 丹凤县| 南岸区| 浦城县| 昌黎县| 时尚| 钟山县| 咸丰县| 哈巴河县| 临桂县| 辽宁省| 泾阳县| 阜宁县| 越西县| 读书| 阜平县| 星子县| 雅安市|