Results 1 to 3 of 3

Thread: Simple question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254

    Simple question

    hey guys,


    can u guys give me the syntax for setting focus to a text box on the page load...? thx =)

    Akababy.Net... Life Redefined!

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Hi Baby,
    You cant set focuse with ASP since it is processed serverside. But it is quite simple to accomplish with Client Side JavaScript.

    Simply do the following

    Code:
    <HTML>
    <HEAD>
    <TITLE></TITLE>
    
    <script language="javascript">
    function SetFocus(id)
    {
    	id.focus();
    }
    </script>
    </HEAD>
    
    <BODY onload="JavaScript:SetFocus(document.form1.t)">
    <form name=form1>
    <input type=textbox name=t><br>
    <input type=textbox name=t2>
    </form>
    
    </BODY>
    </HTML>
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    thank you Danial you are of great help thx

    Akababy.Net... Life Redefined!

Posting Permissions

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



Click Here to Expand Forum to Full Width