隨筆 - 9  文章 - 4  trackbacks - 0
          <2011年9月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          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)光 閱讀(1234) 評論(1)  編輯  收藏

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

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


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 新宁县| 宜阳县| 如皋市| 静安区| 乌鲁木齐市| 鄢陵县| 赣州市| 乐陵市| 灵宝市| 永和县| 黑龙江省| 磐石市| 昌吉市| 新建县| 周至县| 娄底市| 阿勒泰市| 兖州市| 新绛县| 伊川县| 昆明市| 怀柔区| 湖口县| 新乡市| 封开县| 平罗县| 兴海县| 怀柔区| 沧源| 观塘区| 盐池县| 仁寿县| 茶陵县| 冀州市| 当雄县| 双江| 新宾| 资源县| 衢州市| 襄垣县| 红原县|