[thelist] testing for empty in javascript

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


Gotcha, 2 suggestions:

1- put a "total" button, and only tally it then (probably not what
you want)

2- in your function, check to see if the field is empty or full. If
its full, add 1 to cost, if empty, -1 to cost.

Tom
--- Jeremy Weiss <jweiss at cei.net> wrote:
> The page is at https://whatsmyhomevalue.com/membership_form.htm
>
> We 'selling' zip codes to real estate agents.  The reason I want to
> be able
> to remove one and have the total go down is b/c people tend to
> change their
> mind.  An agent may want to purchase a several zip codes, but when
> they see
> the total price they may decide they don't want so many zip codes
> and thus
> they'll go back a remove a few of them.
>
> The site isn't finished yet so don't let errors surprise you.
>
> -Jeremy Weiss
>
> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Tom Dell'Aringa
> Sent: Tuesday, July 16, 2002 12:37 PM
> To: thelist at lists.evolt.org
> Subject: RE: [thelist] testing for empty in javascript
>
>
> 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
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !
>
>
> --
> 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