zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    git的版本回退
    elementui的表格有多选框时翻页记住之前选择的数据
    git操作总结
    POJ 3107 Godfather
    HDU 4405 Aeroplane chess
    ZOJ 3626 Treasure Hunt I
    UVA 10537 Toll! Revisited
    POJ 3093 Margaritas on the River Walk
    POJ 1655 Balancing Act
    POJ 2342 Anniversary party
  • 原文地址:https://www.cnblogs.com/jianfangkk/p/1367162.html
Copyright © 2011-2022 走看看