在嵌入fckeditor的web页面,有如下js
JScript codefunction ttt()
{
alert("ttt");
}function FCKeditor_OnComplete()
{
//页面创建的fckeditor的实例名:infos
var oEditor = FCKeditorAPI.GetInstance('infos') ;
oEditor.Events.AttachEvent('OnFocus',ttt);
}
当焦点在fckeditor时,以上JS可以正常执行。
为何,我将
oEditor.Events.AttachEvent('OnFocus',ttt);
修改为:
oEditor.Events.AttachEvent('OnKeyPress',ttt);
就不能正常执行呢?需要如何处理,才能让fckeditor正常响应keypress事件。
可以给出能正常运行的代码最好。谢谢。
JScript codefunction ttt()
{
alert("ttt");
}function FCKeditor_OnComplete()
{
//页面创建的fckeditor的实例名:infos
var oEditor = FCKeditorAPI.GetInstance('infos') ;
oEditor.Events.AttachEvent('OnFocus',ttt);
}
当焦点在fckeditor时,以上JS可以正常执行。
为何,我将
oEditor.Events.AttachEvent('OnFocus',ttt);
修改为:
oEditor.Events.AttachEvent('OnKeyPress',ttt);
就不能正常执行呢?需要如何处理,才能让fckeditor正常响应keypress事件。
可以给出能正常运行的代码最好。谢谢。
<div id="test" onKeyPress="ttt()">
<?php
include ( "fckeditor/fckeditor.php" ) ;
$oFCKeditor = new FCKeditor ('infos') ;
$oFCKeditor -> BasePath = "fckeditor/" ;
$oFCKeditor -> Value = '' ; //设置默认值
$oFCKeditor->Width ='450px';
$oFCKeditor->Height= '140px'; $oFCKeditor -> Create () ;
$oFCKeditor->Config['SkinPath'] = '/fckeditor/editor/skins/office2003/';
?>
</div>