Cross browser issue in createTextRange()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gsuns82
    New Member
    • Mar 2007
    • 58

    Cross browser issue in createTextRange()

    the following code works fine in IE6 but does not work in Mozilla,any idea to fix this cross browser issue???

    Code

    Code:
    PastedText = document.getElementById("hiddenText").createTextRange();
    				   PastedText.execCommand("Paste");
    Regards,
    Sundar
    Last edited by Dormilich; Aug 21 '09, 12:21 PM. Reason: Please use [code] tags when posting code
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    createTextRange () is an IE specific implementation. the DOM method (used by Mozilla and others) is createRange().

    Comment

    • joshbay84
      New Member
      • Aug 2009
      • 4

      #3
      Similar problem here too:

      I tried below in Mozilla,

      Code:
        document.getElementById("tf").setSelectionRange(0,20);
        document.execCommand("Paste", false, null);
      It does not work.

      Regards,
      Joshua
      Last edited by Dormilich; Aug 21 '09, 12:26 PM. Reason: fixed [code] tags

      Comment

      • joshbay84
        New Member
        • Aug 2009
        • 4

        #4
        Originally posted by Dormilich
        createTextRange () is an IE specific implementation. the DOM method (used by Mozilla and others) is createRange().
        This too does not work, getting the below error in Mozilla:

        Error: document.getEle mentById("hidde nText").createR ange is not a function

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #5
          Originally posted by joshbay84
          Similar problem here too:
          similar answer too. in Mozilla setSelectionRan ge is only part of XUL.

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            Originally posted by joshbay84
            This too does not work, getting the below error in Mozilla:
            well the usage is different, see Range object @ MDC.

            Comment

            Working...