Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/404.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript CKEditor:getSelection().selectElement()用于IE_Javascript_Asp.net_Ckeditor - Fatal编程技术网

Javascript CKEditor:getSelection().selectElement()用于IE

Javascript CKEditor:getSelection().selectElement()用于IE,javascript,asp.net,ckeditor,Javascript,Asp.net,Ckeditor,在编辑器中: 根据我的要求,我只想通过Id选择元素并滚动到该位置 我写的代码在FF中运行良好,但我没有得到IE的解决方案 下面是FF的代码: Ele = EditorInstance.document.getById(Id); EditorInstance.getSelection().selectElement(Ele); Ele.scrollIntoView(); 我试过下面的代码和它的工作 Ele = EditorInstance.document.getById(Id)

在编辑器中: 根据我的要求,我只想通过Id选择元素并滚动到该位置

我写的代码在FF中运行良好,但我没有得到IE的解决方案

下面是FF的代码:

Ele = EditorInstance.document.getById(Id);
EditorInstance.getSelection().selectElement(Ele);
Ele.scrollIntoView();

我试过下面的代码和它的工作

        Ele = EditorInstance.document.getById(Id);            

        EditorInstance.focus(); 
        var element = EditorInstance.document.getBody().getLast();
        var selection = EditorInstance.getSelection();
        selection.selectElement(Ele); 
        selection.scrollIntoView();
基于,

像这样的补丁也能用

Index: _source/plugins/selection/plugin.js
===================================================================
--- a/public/ckeditor-3.6.4/_source/plugins/selection/plugin.js
+++ b/public/ckeditor-3.6.4/_source/plugins/selection/plugin.js
@@ -710,7 +710,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
                        }
                        catch ( e )
                        {
-                               this.isInvalid = true;
+                               document.getWindow().focus();
                        }
                }

Node.getSelection()
的可能重复项在document.selection.createRange()@NULL:不要混淆本机和CKEditor的API。CKEditor提供了许多应该在所有支持的浏览器上工作的方法@user1…:依我看,在选择任何内容之前,您只需聚焦编辑器(
editorInstance.focus()
)。没有这个不行。如果没有帮助,请告诉我们您要选择哪个元素。