[thelist] [Javascript] onKeyUp error, and this should ADD not CONCATENATE

Matt Warden mwarden at gmail.com
Mon Feb 14 01:15:54 CST 2005


Tim,

On Mon, 14 Feb 2005 16:51:41 +1030, Tim Burgan <email at timburgan.com> wrote:
> Ok.. it's official.. I suck at javascript.
> Is anyone able to lend (another) hand?
> 
> I have my 5 text fields.. that dollar values are entered into, then a
> 6th box that calculates the total of all 5 boxes, but the values are not
> being ADDED together for the totals box, instead the code is
> CONCATENATING. What have I done, I can't figure it out?
> 
> Also, what's weird is that when I try to update the text boxes via
> onKeyUp=""  , if I put addTotals() as the attribute value, I get a
> javascript error, but if I put all my javascript on one line then paste
> it into each fields onKeyUp attribute, the code works (except it's
> concatenating or course).

You're going to smack yourself when you see what you did.

I have a yoru code working here:

http://mwarden.f2o.org/sandbox/addtotals.htm

The difference? Well, here's comes the smack.

Your code:
<script type="text/javscript">
my code:
<script type="text/javascript">

That's why addTotals() wasn't defined.

Good luck,

-- 
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.


More information about the thelist mailing list