Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post

    .createTextRange() ???

    What does .createTextRange do? I saw this in a hacked message board to replace certain areas with whatever images etc they wanted. I did a search and of course microsoft was on the top. Of course their examples never work and IE always has an error to complain about. How do I use this? And what other things relate to it?

  • #2
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Not much detail, but I use it to allow people to copy the contents of a <textarea> to their clipboard with the click of a button.

    function copyTo(obj) {
    var oControlRange = obj.createTextRange()
    oControlRange.execCommand("copy");
    }


    <input type="button" onclick="copyTo(this.form.mytextarea)" class="submit" value="Copy Addresses (IE only)">

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #4
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post
    I tried that example (the microsoft link) and it didn't work. Whatever it is, it is not IE 6 compatible and not even for Windows. Stupid M$.
    Last edited by Tails; 07-17-2003 at 06:30 AM.

  • #5
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post
    Can someone tell me what the TextRange stuff is in the source of this page is? The apparently used it to change existing code found in the body to other stuff in order to support their hacked theme. It works fine when I view it, but no examples of TextRange are working. Why?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •