• js判断fck编辑器内容是否为空并获得焦点



     
    01 <script type="text/javascript" language="javascript">
    02 function confirm()
    03 {
    04 var textname=document.getElementById("ctl00_ContentPlaceHolder1_TxtName").value;
    05 if(textname=="")
    06 {
    07 alert("您还是留个称呼吧!");
    08 document.getElementById("ctl00_ContentPlaceHolder1_TxtName").focus();
    09 return false;
    10 }
    11 return getContentValue();
    12 }
    13 function getContentValue()
    14 {
    15 var oEditor =FCKeditorAPI.GetInstance("ctl00_ContentPlaceHolder1_FCKeditor1");
    16 var Content=oEditor.GetXHTML();
    17 if(Content=="")
    18 {
    19 alert("您还没有写留言哦!");
    20 oEditor.Focus();//获取焦点
    21 return false;
    22 }
    23 }
    24 </script>

    注意:

    其中的"ctl00_ContentPlaceHolder1_FCKeditor1"是生成的静态页面中的FCK的实例名称

    src="/Web/fckeditor/editor/fckeditor.html?InstanceName=ctl00_ContentPlaceHolder1_FCKeditor1&amp;

    1 <td style="vertical-align:top; text-align:right;">留言内容:</td><td><div><input type="hidden" id="ctl00_ContentPlaceHolder1_FCKeditor1" name="ctl00$ContentPlaceHolder1$FCKeditor1" value="" /><input type="hidden" id="ctl00_ContentPlaceHolder1_FCKeditor1___Config" value="HtmlEncodeOutput=true" /><iframe id="ctl00_ContentPlaceHolder1_FCKeditor1___Frame" src="/Web/fckeditor/editor/fckeditor.html?InstanceName=ctl00_ContentPlaceHolder1_FCKeditor1&amp;Toolbar=Standard" width="90%" height="150px" frameborder="no" scrolling="no"></iframe></div></td>

  • 相关阅读:
    python基础——协程
    Python基础并发编程——进程
    Python基础并发编程——操作系统
    python基础——socket
    Python基础——网络编程
    文件操作
    深浅拷贝和流程控制
    数据类型
    基础知识
    session和cookie
  • 原文地址:https://www.cnblogs.com/jianfangkk/p/1367162.html
Copyright © 2020-2023  润新知