生活随笔
收集整理的這篇文章主要介紹了
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> | |
轉載于:https://www.cnblogs.com/jianfangkk/archive/2008/12/10/1367162.html
總結
以上是生活随笔為你收集整理的js判断fck编辑器内容是否为空并获得焦点的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。