我已经成功地在IE7上实现了这个功能,但是在FF上不行。有什么想法吗? 谢谢!
var range= window.getSelection().getRangeAt(0);
alert('Current position: '+range.startOffset+' inside '+range.startContainer);
range.setStart(newParent, textOffset);
range.setEnd(newParent, textOffset);
focusEditor: function (n) {
var editor = this.getEditorWindow(n);
if (WYSIWYG_Core.isFF) {
editor.document.body.focus();
try {
var sel = this.getSelection(n);
var range = sel.getRangeAt(0);
range.setStart(sel.anchorNode.childNodes[0], 1);
range.setEnd(sel.anchorNode.childNodes[0], 0);
sel.addRange(range);
}
catch (err) {
//alert(err.description);
}
}
},