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 7 of 7
  1. #1
    New Coder
    Join Date
    Feb 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    "Select all" button for .html page

    Hi guys what i'm trying to do without sucess , can't find anything on google.. Is trying to arrange a button to do a "CTRL+T" (Select all) effect in the HTML i'm currently viewing. Is this possible in Javascript?

    I dont want to select the text in a textbox ! I want it in the whole .html i'm currently viewing.


    Cheers

  • #2
    New Coder
    Join Date
    Feb 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ..

    anyone?

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,189
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    Not really, though you can perhaps get the same *effect*. For example, you could (in MSIE at least, not sure about other browsers) copy all the HTML into the clipboard. Effectively, doing CTRL-A CTRL-C.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    Regular Coder
    Join Date
    Jan 2006
    Posts
    568
    Thanks
    6
    Thanked 84 Times in 84 Posts
    In IE you have document.body.createTextRange().

    http://www.webreference.com/js/column12/index.html

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,189
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    Ahhh...didn't realize a text range could include entire body. Nice.

    Of course, still an IE only answer.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    New Coder
    Join Date
    Feb 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ..

    Hi guys , thanks for the reply. I actually had to change de structure of me website so that code i wanted became obsolete for now .. i want to refresh only a text area box, any ideas if this is possible?

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,189
    Thanks
    75
    Thanked 4,341 Times in 4,307 Posts
    ???

    document.NameOfForm.NameOfTextArea.value = "whatever you want";

    ???

    I don't see what "refresh a text area box" has to do with "select all"???
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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