隨筆 - 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 田園風光 閱讀(1236) 評論(1)  編輯  收藏

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

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


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 溧阳市| 彭山县| 东辽县| 滦南县| 景东| 大渡口区| 禹州市| 兰西县| 金溪县| 甘肃省| 博客| 宁国市| 古丈县| 剑河县| 崇文区| 新闻| 高清| 巩留县| 石棉县| 利川市| 神农架林区| 嘉黎县| 万盛区| 靖西县| 临泉县| 武威市| 张家界市| 宁远县| 锡林郭勒盟| 哈巴河县| 犍为县| 多伦县| 禄劝| 汉川市| 措勤县| 永城市| 祁连县| 浦东新区| 特克斯县| 吉安市| 扬中市|