Re: How to call a JS function on the form loading?

Discussion in 'ASP .Net' started by Alexey Smirnov, Mar 2, 2010.

  1. On Mar 2, 2:53 pm, "aspfun via DotNetMonster.com" <u53138@uwe> wrote:
    > How to call the function validate() on the form loading?
    > There is a form in which another program will fill some text boxes
    > automatically.
    > I need this JS function to test the value of text boxes and give user a alert
    > if any text box is empty.
    >
    > <script type="text/javascript">
    > function validate()
    > {
    >   var t1 = document.getElementById('<%=txtOrderProduct.ClientID%>');
    >   var t2 = document.getElementById('<%=txtOrderBy.ClientID%>');
    >
    >   if(t1.value == "" && t2.value == "")
    >   {
    >     alert("Empty');
    >   }}
    >
    > </script>
    >
    > --
    > Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Forums.aspx/asp-net/201003/1


    Use <body onload="validate();">.

    Hope this helps
    Alexey Smirnov, Mar 2, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. grbgooglefan
    Replies:
    2
    Views:
    408
    Pascal Bourguignon
    Jan 30, 2008
  2. grbgooglefan
    Replies:
    4
    Views:
    428
    Kenny McCormack
    Jan 30, 2008
  3. grbgooglefan
    Replies:
    0
    Views:
    382
    grbgooglefan
    Jan 30, 2008
  4. Alok
    Replies:
    3
    Views:
    237
  5. THAKUR PRASHANT SINGH

    Class Function call vs Normal Function call

    THAKUR PRASHANT SINGH, Feb 26, 2010, in forum: Ruby
    Replies:
    7
    Views:
    170
    THAKUR PRASHANT SINGH
    Feb 27, 2010
Loading...

Share This Page