How can I plus the value

Discussion in 'ASP General' started by Jack, Nov 6, 2003.

  1. Jack

    Jack Guest

    Hello,
    I wrote this code:

    <SCRIPT LANGUAGE=VBScript RUNAT=Server>
    dim ab
    ab=0
    Response.Write "<INPUT type=""text"" id=customername name=customername
    onchange=""ab=ab+1"" value=""abc"">"
    Response.Write "<BR>"
    Response.Write "<INPUT type=""text"" id=text1 name=text1 value =" & ab &
    ">"
    ....
    </SCRIPT>

    But onchange the customername's text ,ab's value was no plus.Can you help
    me.
    Jack, Nov 6, 2003
    #1
    1. Advertising

  2. Jack

    Bob Barrows Guest

    Jack wrote:
    > Hello,
    > I wrote this code:
    >
    > <SCRIPT LANGUAGE=VBScript RUNAT=Server>
    > dim ab
    > ab=0
    > Response.Write "<INPUT type=""text"" id=customername
    > name=customername onchange=""ab=ab+1"" value=""abc"">"
    > Response.Write "<BR>"
    > Response.Write "<INPUT type=""text"" id=text1 name=text1 value =" &
    > ab & ">"
    > ...
    > </SCRIPT>
    >
    > But onchange the customername's text ,ab's value was no plus.Can you
    > help me.


    Your problem is lack of understanding where the code is executing.

    Everything in the script block runs at the server. That means the variable
    you declared in that script block is only visible to the code that is
    running on the server.

    The onchange event takes place at the client. The code running on the client
    machine has no idea about any variables that were declared in the
    server-side code.. You will need to write some client-side code to declare a
    client-side variable in the window's onload event, along with code in the
    INPUT's onchange event to display the new value for ab when it gets changed.

    You should follow up on a client-side coding newsgroup (look for one with
    "dhtml" in its name, or go to m.p.scripting.vbscript or
    m.p.scripting.jscript)

    HTH,
    Bob Barrows

    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"
    Bob Barrows, Nov 6, 2003
    #2
    1. Advertising

  3. Jack

    Jack Guest

    Thank you!
    But I don't know how can I do.
    Can you give me a simple sample.
    Jack, Nov 7, 2003
    #3
    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. =?Utf-8?B?TXIgV2l6YXJk?=
    Replies:
    2
    Views:
    1,670
    =?Utf-8?B?TXIgV2l6YXJk?=
    Jan 5, 2004
  2. The LoxFather

    C plus plus vs C Sharp

    The LoxFather, Aug 9, 2003, in forum: C++
    Replies:
    23
    Views:
    9,205
  3. The LoxFather

    C plus plus vs C Sharp

    The LoxFather, Aug 9, 2003, in forum: C Programming
    Replies:
    23
    Views:
    1,385
  4. Rahul
    Replies:
    9
    Views:
    419
    Andrey Tarasevich
    Mar 25, 2008
  5. furqan shaikh

    c plus plus code comparator

    furqan shaikh, Nov 7, 2008, in forum: C++
    Replies:
    6
    Views:
    816
    red floyd
    Nov 12, 2008
Loading...

Share This Page