(editor1doc.selection).type does not work in Firefox?

  •  11-01-2007, 6:45 PM

    (editor1doc.selection).type does not work in Firefox?

    The following Javascript function is called in the onclick event of an ASP.NET image button.   I put alert statements after each line to isolate where it is failing in Firefox for Windows 2.0.0.8.   In IE, this works fine and goes all the way through (pasting the string **FILE1** into the editor).   But, in Firefox, only the first three alerts show.   The fourth, which references (editor1doc.selection).type does not display, the function apparently ends at that point and the **FILE1** string is not pasted into the editor.
     
    Can you determine what is wrong?   Thanks.
     
    function CE_MarkEmbedObjectPosition()
    {
     alert("DEBUG: START CE_MARKEMBEDOBJECTPOSITION");
     // get the cute editor instance
     var editor1 = document.getElementById('');
     alert("DEBUG: CE_MARKEMBEDOBJECTPOSITION, after var editor1=" + editor1);
    var editor1doc = editor1.GetDocument();
    alert("DEBUG: CE_MARKEMBEDOBJECTPOSITION, after var editor1doc");
     alert("DEBUG:CE_MarkEmbedObjectPosition, (editor1doc.selection).type=" + (editor1doc.selection).type);
     if ((editor1doc.selection).type == "Text")
    {
     var selectedhtml = editor1doc.selection.createRange().htmlText;
    alert("DEBUG: CE_MarkEmbedObjectPosition, Text, selectedhtml=" + selectedhtml);
     editor1.PasteHTML(selectedhtml + "**FILE1**");
     }
     if ((editor1doc.selection).type == "None")
     {
     var selectedhtml = editor1doc.selection.createRange().htmlText;
     alert("DEBUG: CE_MarkEmbedObjectPosition, None, selectedhtml=" + selectedhtml);
     editor1.PasteHTML(selectedhtml + "**FILE1**");
     }
     alert("DEBUG:End of CE_MarkEmbedObjectPosition, gethtml=" + CE_getHTML());
     }
View Complete Thread