Results 1 to 2 of 2

Thread: no select text script

  1. #1
    Join Date
    Jun 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default no select text script

    In the no select text script page ,we cannot select any text but can select the text in the box that let us put it in our HTML. How is it possible? Can you teach us how to do it?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,025
    Thanks
    44
    Thanked 3,210 Times in 3,172 Posts
    Blog Entries
    12

    Default

    Put this script in the head of your page:
    Code:
    <script type="text/javascript">
    function highlight(x){
    document.forms[x].elements[0].select()
    }
    </script>
    Then, in the body, you can use this link to highlight (select) text in a text box that is the first element of a form numbered 'x' (forms are seen by javascript as numbered on each page starting with 0):
    Code:
    <a href="javascript:highlight(x)">Select</a>
    Using 0 in place of the red x, this would work on a text area in a form like this:
    HTML Code:
    <form>
    <textarea rows="10" cols="10">
    Put the text you want highlighted here
    </textarea></form>
    provided it is the first form on the page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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