[thelist] testing for empty in javascript or vbscript

Tom Dell'Aringa pixelmech at yahoo.com
Mon Jul 15 19:10:10 CDT 2002


Jeremy,

document.memberform.amountdue = (cost * 79.95)

needs to be

document.memberform.amountdue.value = (cost * 79.95)

amountdue is just an object reference with no property.

Tom

P.S. You could also do it the other way, but don't forget to use the
value property. Either way should work.

--- Jeremy Weiss <jweiss at cei.net> wrote:
> Okay, obviously I'm being especially slow today, b/c I'm still not
> getting
> this.  Here's what I've got.
>
> <script LANGUAGE="JavaScript">
> function Countit() {
>    cost=0
>    for(i=0; i<=16; i++)
>    {
>       zip = "zip" + i;
>       if(document.memberform.zip[i] = "")
>       {
>          //this is for empty boxes
>       }
>          cost = cost + 1
>          document.memberform.amountdue = (cost * 79.95)
>          return
>    }
> }
> </script>
>
> and then there's the text boxes
>
>    <input type="text" name="zip1" size="6"
> onchange="CountIt()">&nbsp;
>    <input type="text" name="zip2" size="6"
> onchange="CountIt()">&nbsp;
>    <input type="text" name="zip3" size="6"
> onchange="CountIt()">&nbsp;
>
> plus 12 more.  And then there's the amount box.
>
>    <input type="text" name="amountdue" size="20">
>
> Right now when I try this, the page throws an error saying "object
> expected"
> and give the line number of whatever textbox I just typed in.  All
> I'm
> trying to do is have it update the amountdue box.
>
> TIA,
> 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