pls help me
my function is not working in IE, what wrong in script
function FCKeditor_OnComplete(editorInstance )
{
editorInstance.Events.AttachEvent( 'OnSelectionChange' , selectedtext ) ;
}
function selectedtext()
{
var editorInstance = FCKeditorAPI.GetInstance('FCKeditor1') ;
var selection = (editorInstance.EditorWindow.getSelection ? editorInstance.EditorWindow.getSelection() : editorInstance.EditorDocument.selection);
alert(getSelectionHTML(selection))
}
// get HTML from selection
function getSelectionHTML(selection)
{
var range = (document.all ? selection.createRange() : selection.getRangeAt(selection.rangeCount - 1).cloneRange());
if (document.all)
{
return range.htmlText;
}
else
{
var clonedSelection = range.cloneContents();
var div = document.createElement('div');
div.appendChild(clonedSelection);
return div.innerHTML;
}
}
my function is not working in IE, what wrong in script
function FCKeditor_OnComplete(editorInstance )
{
editorInstance.Events.AttachEvent( 'OnSelectionChange' , selectedtext ) ;
}
function selectedtext()
{
var editorInstance = FCKeditorAPI.GetInstance('FCKeditor1') ;
var selection = (editorInstance.EditorWindow.getSelection ? editorInstance.EditorWindow.getSelection() : editorInstance.EditorDocument.selection);
alert(getSelectionHTML(selection))
}
// get HTML from selection
function getSelectionHTML(selection)
{
var range = (document.all ? selection.createRange() : selection.getRangeAt(selection.rangeCount - 1).cloneRange());
if (document.all)
{
return range.htmlText;
}
else
{
var clonedSelection = range.cloneContents();
var div = document.createElement('div');
div.appendChild(clonedSelection);
return div.innerHTML;
}
}
Re: OnSelectionChange, onclick event not working in IE
you code looks ok, so no idea.
Only improvement possible I can see is that you can receive the editorInstance as a parameter in the event function, see http://docs.fckeditor.net/FCKeditor_2.x ... API#Events
So you can do function selectedtext(editorInstance) instead of finding it in the function.
Re: OnSelectionChange, onclick event not working in IE
So, what other factors that causes the problem? With the posted problem and link, I think its ok that's why I find it hard to decipher the real problem.
-----------------------------
mask of editors