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&
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&Toolbar=Standard" width="90%" height="150px" frameborder="no" scrolling="no"></iframe></div></td>
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&
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&Toolbar=Standard" width="90%" height="150px" frameborder="no" scrolling="no"></iframe></div></td>