[英]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.