隨筆 - 9  文章 - 4  trackbacks - 0
          <2009年7月>
          2829301234
          567891011
          12131415161718
          19202122232425
          2627282930311
          2345678

          常用鏈接

          留言簿

          隨筆檔案

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          //取fck內(nèi)容的長度
          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在頁面所設(shè)的名字
              {
                  alert('請輸入內(nèi)容');       
                  return false;
              }
          }

          //取fck內(nèi)容
          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 田園風(fēng)光 閱讀(1236) 評論(1)  編輯  收藏

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

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 江川县| 达孜县| 永济市| 蕉岭县| 河源市| 肃宁县| 滨州市| 林周县| 城市| 尚志市| 西安市| 顺义区| 五大连池市| 昔阳县| 湖南省| 南召县| 通榆县| 吐鲁番市| 滨州市| 余干县| 新野县| 蒙阴县| 富裕县| 格尔木市| 色达县| 华安县| 金平| 汝城县| 托克逊县| 德化县| 永顺县| 抚宁县| 嘉善县| 金阳县| 科尔| 朔州市| 洮南市| 祁门县| 石棉县| 云浮市| 边坝县|