[thelist] testing for empty in javascript or vbscript

Jeremy Weiss jweiss at cei.net
Mon Jul 15 18:54:04 CDT 2002


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




More information about the thelist mailing list