林林菜园
www.code84.com

Js 验证FCKeditor输入内容是否为空

Var oEditor=FCKeditorAPI.GetInstance("ctl00_ContentPlaceHolder1_fckContent");

       var Content=oEditor.GetXHTML();

       if(Content=="")

       {

        alert("请填写内容!");

        oEditor.Focus();//获取焦点

        return false;

      }

 

获取FCKeditor上传的图片路径

string detali = this.fckContent.Value.Trim();

string path="";

        MatchCollection matchs = Regex.Matches(detali, "(src=)('|" + (char)34 + "| )?(.[^'| |" + (char)34 + "]*)("".)(jpg|gif|png|bmp|jpeg)('|" + (char)34 + "| |>)?", RegexOptions.IgnoreCase);

        foreach (Match m in matchs)

        {

            path+=m+"...";//以...分隔给图片路径

     }

此方法获得的图片路径是相对路径

注:引用 using System.Text.RegularExpressions;

 

自定义FCKeditor后调用FCK的代码

                <FCKeditorV2:FCKeditor ID="FCKContent" runat="server" BasePath="../Files/" Width="100%"
                    Height="400px" ToolbarSet="yykj520.cn/">
                </FCKeditorV2:FCKeditor>

自定义FCKeditor的工具栏只需要修改Files文件夹里的fckconfig.js文件内容——FCKConfig.ToolbarSets的值。

posted on 2009-05-25 17:50  林林菜园  阅读(329)  评论(0)    收藏  举报