Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: FORM AND JAVASCRIPT


Message #1 by "Pallone, Claudio [KMR-SPC]" <Claudio.Pallone@k...> on Fri, 1 Mar 2002 14:59:17 -0000
This is a multi-part message in MIME format.

--Boundary_(ID_uTkBexxeAdeqCmt00q8RMg)
Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: 7bit

FORM AND JAVASCRIPTIf you trying to make it work on IE add id= attribute
into you items.
like :
<form name=frm1 id=frm1>

Age <input type="text" name=age id=age>

Oleg.



  -----Original Message-----
  From: Pallone, Claudio [KMR-SPC] [mailto:Claudio.Pallone@k...]
  Sent: March 01, 2002 9:59 AM
  To: JavaScript HowTo
  Subject: [javascript_howto] FORM AND JAVASCRIPT
  Importance: High


  Hi,

  I have a form with 2 input fields. I would like to pass the value that
people type in those fields to a JavaScript function, assign them to a
variable so that I can do some calculations on them. This is what I have
tried but to no avail. When I try to document.write the variables Age and
Income I do not get the values people typed in the form. I just get the text
AgeIncome.


  Please could you let me know what I am doing wrong?

  Cheers,

  Claudio

  <html>

  <head>
      <script language=javascript>
          function TaxCalculation() {
              var Age = document.frm1.age.value
              var Income = document.frm1.income.value
   document.write(Age)
   document.write(Income)

          }
      </script>
  </head>

  <body>

  <form name=frm1>

  Age <input type="text" name=age>
  Income <input type="text" name=income>
  <input type=button value=Calculate onclick="TaxCalculation()"

  </form>

  </body>

  </html>




  BMRB International
  http://www.bmrb.co.uk +44 (0)20 8566 5000

  ____________________________________________________________
  This message (and any attachment) is intended only for the recipient and
may contain confidential and/or privileged material. If you have received
this in error, please contact the sender and delete this message
immediately. Disclosure, copying or other action taken in respect of this
email or in reliance on it is prohibited. BMRB International Limited accepts
no liability in relation to any personal emails, or content of any email
which does not directly relate to our business.

$subst('Email.Unsub').


  Return to Index