Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004

    Unhappy Unanswered: how to

    i have problem now with my calculation..i have 4 textfield what i want is to add first,second and third textfield and total of this 3 appear in textfield number 4


    textfield 1 + textfield 2 + textfield 3 = textfield 4

    plzzzzzzzzzzzzz i'm new in asp

  2. #2
    Join Date
    Jul 2003
    Sounds like you want JavaScript instead of ASP. Do you want textfield1, textfield2, and textfield3 to sum and update textfield4 dynamically, or do you expect this to sum on the refresh of the page?

    In JS it'd be:
    <script language="javascript">
    function updateTextField(){
      if(!isNaN(document.myform.textfield1.value) && !isNaN(document.myform.textfield2.value) && !isNaN(document.myform.textfield3.value)){
        document.myform.textfield4.value = Number(document.myform.textfield1.value) + Number(document.myform.textfield2.value) + Number(document.myform.textfield3.value);
    <form name="myform">
      <input name="textfield1" type="text" onChange="updateTextField();"><BR>
      <input name="textfield2" type="text" onChange="updateTextField();"><BR>
      <input name="textfield3" type="text" onChange="updateTextField();"><BR>
      <input name="textfield4" type="text" READONLY><BR>
    In ASP (test.asp) it'd be:
    <form action="test.asp?Update=1" method="post">
      <input name="textfield1" type="text"><BR>
      <input name="textfield2" type="text"><BR>
      <input name="textfield3" type="text"><BR>
    If CInt(Trim(Request.QueryString("Update"))) = 1 Then
      Dim iSumFields
      iSumFields = CInt(Trim(Request.Form("textfield1")))
      iSumFields = iSumFields + CInt(Trim(Request.Form("textfield2")))
      iSumFields = iSumFields + CInt(Trim(Request.Form("textfield3")))
      Response.Write "Value: " & iSumFields & "<BR>"
    End If
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    May 2004

    thnak you

    thank problem is already solve .... i use the java script....because when i use asp have a problem....thank u very much

Posting Permissions

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