Home > Backend Development > PHP Tutorial > 大家帮小弟我看看,如何获取这个文本框的焦点

大家帮小弟我看看,如何获取这个文本框的焦点

WBOY
Release: 2016-06-13 13:13:45
Original
1047 people have browsed it

大家帮我看看,怎么获取这个文本框的焦点
文本内容编辑是用的FCK,这是在HTML页面中查看源码得到的结果:

HTML code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<td width="100%" id="arcBody">
      <input type="hidden" id="body" name="body" value="请输入文本内容" style="display:none">
      <input type="hidden" id="body___Config" value="FullPage=FALSE" style="display:none">
      <iframe id="body___Frame" src="www.5i5qq.com/editor/fckeditor.html?InstanceName=body&Toolbar=Basic" width="100%" height="450" frameborder="0" scrolling="no"></iframe>    </td>
<td width="255" align="center" valign="top" bgcolor="#FFFFCC" id="mPic" style="display:none"><div class="multipic">
      <div style="display: block;background-color:#E5F1CF; height:26px"><span id="spanButtonPlaceholder"></span></div>
      <div id="divFileProgressContainer"></div>
      <div id="thumbnails" style="width: 254px; height: 535px; background-color: rgb(255, 255, 255); overflow-y: scroll;"></div>
</div></td>

Copy after login

我想实现打开页面的时候,获取文本编辑器的焦点,并让鼠标定位在其中。请问用JS怎么实现。谢谢了。

------解决方案--------------------
这个比较复杂,需要使用 FCK 提供的 js 函数
在 FCK 的样例中,有详细的:定位、读取、插入、追加、替换等各种操作的演示

如果你的 FCK 中没有 _samples 或 _testcases 目录,那么请下载一个完整的版本
------解决方案--------------------
$("#body").focus();
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template