[thelist] testing for empty in javascript

Tom Dell'Aringa pixelmech at yahoo.com
Tue Jul 16 12:37:06 CDT 2002


Jeremy, could you maybe take a step back and tell us what the page
needs to do? Adding up something, then turning around and removing it
is work you shouldn't have to do I'm guessing. Maybe show us the
whole page of code if its not too long, or give us a link, which is
better.

Tom

--- Jeremy Weiss <jweiss at cei.net> wrote:
> Okay, here's what I've got right now.
>
>
> <script LANGUAGE="JavaScript">
> var cost=0;
> function ChangeTotal() {
>    if(document.memberform.zip != "")
>    {
>       cost = cost + 1;
>       amountdue = cost * 79.95
>       document.memberform.amountdue.value = amountdue;
>    }
> }
> </script>
>
> <form name="memberform">
> <input type="text" name="zip" size="6"
> onChange="ChangeTotal();">&nbsp;
> <input type="text" name="zip" size="6"
> onChange="ChangeTotal();">&nbsp;
> <input type="text" name="zip" size="6"
> onChange="ChangeTotal();">&nbsp;<br>
> <input type="text" name="amountdue" size="20">
> </form>
>
>
> It works with the exception of two things.  1)When someone goes
> back and
> removes a zip code they typed in, it raises the total again.  I
> need a way
> to lower it in this instance.  2) The total needs to be formatted
> as
> currency, what's the easiest way to accomplish it?
>
> Sorry for all the remedial work I'm throwing out... think of it as
> a
> refresher course. ;)
>
> Thanks for all the help.
>
> -Jeremy Weiss
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !


=====
var me = tom.pixelmech.webDeveloper();
http://www.pixelmech.com/

__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com



More information about the thelist mailing list