日期:2014-05-17 浏览次数:20453 次
//设置ckeditor的焦点,并高亮背景显示 function setFocus() { var editor = CKEDITOR.instances.editor1; editor.focus(); editor.document.$.body.style.cssText = "background-color:#ff9"; }
------解决方案--------------------
现在只试到设置config.js,可以在加载时获取焦点
config.startupFocus = true;
------解决方案--------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> <script type="text/javascript" src="ckeditor/ckeditor.js"></script> <script type="text/javascript"> window.onload = function() { CKEDITOR.replace('tbContent'); }; </script> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="tbContent" runat="server" TextMode="MultiLine" CssClass="ckeditor">abc</asp:TextBox><br /> <input type="button" onclick="setFocus();" value="点额" /> </div> </form> </body> </html> <script type="text/javascript"> function setFocus() { var editor = CKEDITOR.instances.tbContent; editor.focus(); } </script>