SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: select()

  1. #1
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    select()

    trying to get it so any click on the textbox will select the entire text. What's wrong with this?

    <script language="javascript">
    function selectBox(f){
    alert(f);
    document.formhandheld.f.select();
    }

    <script>





    <input type="text" value="testing" onClick="selectBox(this)">

  2. #2
    SitePoint Evangelist Mr. Brownstone's Avatar
    Join Date
    May 2002
    Location
    Relative
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have marked the corrections. This works for me:
    Code:
    <script language="javascript">
    function selectBox(f){
    alert(f);
    f.select();  
    }
    </script>
    
    <input type="text" value="testing" onClick="selectBox(this)">
    Of course, that's just my opinion. I could be wrong.

  3. #3
    SitePoint Wizard silver trophy Crazybanana's Avatar
    Join Date
    Mar 2003
    Location
    In tha fruit cellar
    Posts
    1,379
    Mentioned
    32 Post(s)
    Tagged
    1 Thread(s)
    why that annoying alertbox? why not just make it select the text when clicked ?

    function select(){
    select();
    }


    onClick="select(this)"

    or

    function Select() {
    document.formhandheld.select();
    }

    onClick="select(this)"
    Who's to doom when the judge himself is dragged before the bar


    Home | Web | Facebook

  4. #4
    SitePoint Evangelist Mr. Brownstone's Avatar
    Join Date
    May 2002
    Location
    Relative
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Iíd wager the alert-box was put in for testing. Itís in his original source, so I guess he knows why itís there.
    Of course, that's just my opinion. I could be wrong.

  5. #5
    SitePoint Wizard silver trophy Crazybanana's Avatar
    Join Date
    Mar 2003
    Location
    In tha fruit cellar
    Posts
    1,379
    Mentioned
    32 Post(s)
    Tagged
    1 Thread(s)
    yes he should know himself, but Im just curious
    Who's to doom when the judge himself is dragged before the bar


    Home | Web | Facebook


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
  •