简体   繁体   English

如何在Yahoo Rich Text Editor中设置焦点

[英]How can I set the focus inside the Yahoo Rich Text Editor

I have a an HTML form which contains the YAHOO rich text editor on it. 我有一个HTML表单,其中包含YAHOO富文本编辑器。

When I display the form I want the YAHOO editor to have focus so that the cursor is ready to accept input without the user having to click on it or tab into it 当我显示表单时,我希望YAHOO编辑器具有焦点,以便光标准备好接受输入,而用户不必单击它或将其制表符

I got this from the documenation over at the YUI library . 我是从YUI库的文档中得到的。 Specifically at a sample titled Editor - Basic Buttons 特别是在标题为“ 编辑器-基本按钮 ”的示例中

var myEditor = new YAHOO.widget.Editor('editor', {focusAtStart:true});
myEditor.render();

The key here is the the "focusAtStart" attribute as part of the optional attributes object 此处的关键是作为可选属性对象一部分的“ focusAtStart”属性

我尚未使用YAHOO富文本编辑器,但是如果您使用window.onload事件,它不会起作用吗?

Like roenving, I have never used the YAHOO rich text editor, but it should work with the window.onload event. 像漫游一样,我从未使用过YAHOO富文本编辑器,但它应该与window.onload事件一起使用。

Let's say you specified id="yahoo_text_editor" for your YAHOO rich text editor. 假设您为YAHOO富文本编辑器指定了id="yahoo_text_editor"
Then, do 然后做

<body onload="document.getElementById('yahoo_text_editor').focus()">

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Yahoo YUI 2-RTF编辑器-如何将编辑器的标题栏更改为另一个字符串值? - Yahoo YUI 2 - Rich Text Editor - how do I change the titlebar of the Editor to another string value? Yahoo YUI 2 - 富文本编辑器 - 无法使用 setEditorHTML 方法,怎么了? - Yahoo YUI 2 - Rich Text Editor - can't get setEditorHTML method to work, what's wrong? 富文本编辑器和按提交焦点按钮 - Rich Text Editor and focus by submit button 如何使用文本内任何位置的可上传图像实现富文本编辑器 - How to implement a Rich Text Editor with uploadable images anywhere inside text HtmlUnit是否可以支持将内容设置为在线RTF编辑器? - Can HtmlUnit support to set the content to an online rich text editor? 将html插入yahoo的YUI富文本编辑器 - inserting html into yahoo's YUI rich text editor 如何将文本从富文本编辑器发送到 sql 数据库? - how can i send text from a rich text editor into a sql database? 如何将页面上的CKEDitor实例设置为始终为RTF编辑器 - How to set an instance of CKEDitor on the page to be always Rich Text Editor 如何显示Redactor富文本/ html编辑器的字符数/字数? - How can I display a character count / word count for Redactor rich text / html editor? 我怎么知道 Summernote(富文本编辑器)是专注的? - How to I know that Summernote (rich text editor) is focused?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM