pasteHTML for Firefox?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • geevaa

    pasteHTML for Firefox?

    Hi All,


    Try the example javascript given in this link in IE and Firefox.




    <html>
    <body>
    <script language="JavaS cript">
    function function1() {
    var myRange = document.select ion.createRange ();
    var m = myRange.pasteHT ML('<p>Hello World</p>');
    }
    </script>
    <p>Highlight a part of this text, then click button below</p>
    <input id="myB" type="button" value="Click me" onclick="functi on1();">
    </body>
    </html>





    Its works only in IE and not in Firefox.
    Is there is any Firefox equivalent coding to achieve the same
    functionality which is working good in IE?

    Thanks in advance.




  • Bart Van der Donck

    #2
    Re: pasteHTML for Firefox?

    geevaa wrote:
    <html>
    <body>
    <script language="JavaS cript">
    function function1() {
    var myRange = document.select ion.createRange ();
    var m = myRange.pasteHT ML('<p>Hello World</p>');}
    >
    </script>
    <p>Highlight a part of this text, then click button
    below</p>
    <input id="myB" type="button" value="Click me"
    onclick="functi on1();">
    </body>
    </html>
    >
    Its works only in IE and not in Firefox.
    Is there is any Firefox equivalent coding to achieve the
    same functionality which is working good in IE?
    The problem is that 'document.selec tion.createRang e' is not supported
    everywhere. Martin Honnen wrote an elegant approach:



    Hope this helps,

    --
    Bart

    Comment

    Working...