Loading ...
Sorry, an error occurred while loading the content.

Javascript Form Help

Expand Messages
  • saminor2002
    Hi guys, I am new to this club and hope to find your help as soon as possible. I have an order form, where customers can buy single items or multiple items. It
    Message 1 of 6 , Dec 1, 2007
    • 0 Attachment
      Hi guys,
      I am new to this club and hope to find your help as soon as possible.
      I have an order form, where customers can buy single items or multiple
      items. It works like this: the company sets the prices in dollar, but
      users also know the equalivalent in euro. If a customer orders 4 items
      that worth 4dollars, the total is told in both dollar and euro. But
      when the customer wants to order in bulk, i was not able to do the
      conversion because the number of textboxes is built dynamically. I
      need to tell the customer the ttl amount per group of items (e.g. CD
      roms and dvd roms) and then the total amount of all the items. Sorry
      my english is not good. Need further explanation, let me know.

      Sami
    • Tim Sabin
      I ve got an idea of what you need, but it s hard to say without looking at the code. Please post your entire page (both HTML and JavaScript) and let us have a
      Message 2 of 6 , Dec 1, 2007
      • 0 Attachment
        I've got an idea of what you need, but it's hard to say without looking
        at the code. Please post your entire page (both HTML and JavaScript) and
        let us have a look.

        --Tim Sabin


        saminor2002 wrote:
        > Hi guys,
        > I am new to this club and hope to find your help as soon as possible.
        > I have an order form, where customers can buy single items or multiple
        > items. It works like this: the company sets the prices in dollar, but
        > users also know the equalivalent in euro. If a customer orders 4 items
        > that worth 4dollars, the total is told in both dollar and euro. But
        > when the customer wants to order in bulk, i was not able to do the
        > conversion because the number of textboxes is built dynamically. I
        > need to tell the customer the ttl amount per group of items (e.g. CD
        > roms and dvd roms) and then the total amount of all the items. Sorry
        > my english is not good. Need further explanation, let me know.
        >
        > Sami
        >
        >
        >
        > Visit http://aiaiai.com for more groups to join
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
      • saminor2002
        Thanks Guys! Here is the code. The first one is which works fine, when a user wants to order a single item. The second one is the one used when a user have to
        Message 3 of 6 , Dec 3, 2007
        • 0 Attachment
          Thanks Guys! Here is the code. The first one is which works fine,
          when a user wants to order a single item. The second one is the one
          used when a user have to order multiple items which is not working.


          '********************************************************************
          '********************************************************************
          '********************************************************************
          <html>
          <head>
          <script language="javascript" type="text/javascript">
          function setmoney() {
          document.forms.purchase.ttldollar.value=document.forms.purchase.orderh
          owmany.value*25000
          document.forms.purchase.ttlnacfa.value=20*document.forms.purchase.ttld
          ollar.value
          document.forms.purchase.ttleuro.value=document.forms.purchase.ttlnacfa
          .value/25
          }

          </script>
          <title>Anberbeb Share Company -Buy</title>
          </head>
          <body>
          <table border="0" cellpadding="0" cellspacing="0" width="80%"
          align="center">
          <tr>
          <td width="14" height="32" valign="top"></td>
          <td width="720" height="32" colspan="4" valign="top">Home
          Shopcart Currency </td>
          </tr>
          <tr>
          <td width="14" height="29" valign="top"></td>
          <td width="720" height="29" colspan="4" valign="top"><div
          align="left"><span class="style3">Secure Order Form </span></div></td>
          </tr>
          <tr>
          <td width="14" height="226" valign="top"></td>
          <td width="514" height="226" valign="top" align="center"><form
          name="purchase" action="buy.php" method="POST"><table border="1"
          width="512"><tr><td colspan="2">Delivery Address</td></tr>
          <tr><td valign="top">Address</td><td><textarea readonly="readonly"
          cols="20" rows="4" name="address">pobox 10786</textarea></td></tr>
          <tr><td>City</td><td><input type="text" name="city" value="Asmara"
          readonly="readonly"></td></tr>
          <Tr><td>Country</td><td><input type="text" name="country"
          value="Eritrea" readonly="readonly"></td></tr>
          <tr><td>Tele</td><td><input type="text" name="tele" value="152151"
          readonly="readonly"></td></tr>
          <tr><td colspan="2" align="right"><a href="#">Edit
          Address</a></td></tr>
          <tr><td colspan="2">Order Information</td></tr>
          <tr><td>Car</td><td>Ambulance coaster</td></tr>
          <tr><td>Unit Price</td><td>25000 USD</td></tr>
          <tr><td><input type="hidden" name="unitprice" value="25000"><input
          type="hidden" name="ttlinstore" value="7"></td><td><input
          type="hidden" name="item" value="S"><input type="hidden" name="c"
          value="1001AB100001"></td></tr>
          <tr><td>Availiable in Store</td><td>7 Cars</td></tr>
          <tr><td>Order how many</td><td><select name="orderhowmany"
          onClick="setmoney();" onChange="setmoney();"><option value="1">1
          Cars</option>
          <option value="2">2 Cars</option>
          <option value="3">3 Cars</option>
          <option value="4">4 Cars</option>
          <option value="5">5 Cars</option>
          <option value="6">6 Cars</option>
          <option value="7">7 Cars</option>
          </select>
          </td></tr>
          <tr><td colspan="2">Payment Options</td></tr>
          <tr><td>Pay In</td><td><select name="currency" onClick="setmoney();"
          onChange="setmoney();"><option value="Dollar"
          selected="selected">Dollar</option><option
          value="Euro">Euro</option><option
          value="Nacfa">Nacfa</option></select></td></tr>
          <tr><td valign="top">Total Price</td><td><input type="text"
          readonly="readonly" size="11" name="ttldollar"> Dollar<br><input
          type="text" readonly="readonly" size="11" name="ttleuro">
          Euro<br><input type="text" readonly="readonly" size="11"
          name="ttlnacfa"> Nacfa</td></tr>
          <tr><td colspan="2">Payment Method</td></tr>
          <tr><td><input type="radio" name="paymethods[]"
          value="1">Online</td><td>Credit Card<br><select
          name="creditcar"><option value="Visa">Visa</option><option
          value="Master">Master</option><option
          value="Discover">Discover</option></select><br>Card Holder
          Name<br><input type="text" name="cardholdername"><br>Expiry
          Date<br><input type="text" name="expdate"></td></tr>
          <tr><td><input type="radio" name="paymethods[]"
          value="2">Phone</td><td>Phone</td></tr>
          <tr><td><input type="radio" name="paymethods[]"
          value="3">Fax</td><td>FAX</TD></TR>
          <tr><td colspan="2" align="center"><input type="submit" value="Order"
          name="submit"></td></tr>
          </table></form>
          </td>
          <td width="7" height="226" valign="top"></td>
          <td width="196" height="226" valign="top">Rate of
          Exchange:<br>One Dollar=20 Nacfa<br>One Euro=25 Nacfa</td>
          <td width="3" height="226" valign="top"></td>
          </tr>
          <tr>
          <td width="14" height="1" valign="top"><img src="transparent.gif"
          alt="" width="14" height="1"></td>
          <td width="514" height="1" valign="top"><img
          src="transparent.gif" alt="" width="514" height="1"></td>
          <td width="7" height="1" valign="top"><img src="transparent.gif"
          alt="" width="7" height="1"></td>
          <td width="196" height="1" valign="top"><img
          src="transparent.gif" alt="" width="196" height="1"></td>
          <td width="3" height="1" valign="top"><img src="transparent.gif"
          alt="" width="3" height="1"></td>
          </tr>
          </table>
          </body>
          </html>


          '*******************************************************************
          '*********************************************************************
          **********************************************************************
          *

          SECOND FILE

          '********************************************************************
          '******************************************************************
          '********************************************************************

          <html>
          <head>
          <script language="javascript" type="text/javascript">

          </script>
          <title>Anberbeb Share Company -Buy</title>

          </head>
          <body>
          <table border="0" cellpadding="0" cellspacing="0" width="80%"
          align="center">
          <tr>
          <td width="14" height="32" valign="top"></td>
          <td width="720" height="32" colspan="4" valign="top">Home
          Shopcart Currency </td>
          </tr>
          <tr>
          <td width="14" height="29" valign="top"></td>
          <td width="720" height="29" colspan="4" valign="top"><div
          align="left"><span class="style3">Secure Order Form </span></div></td>
          </tr>
          <tr>
          <td width="14" height="226" valign="top"></td>
          <td width="514" height="226" valign="top" align="center"><form
          name="purchase" action="buy.php" method="POST"><table border="1"
          width="512"><tr><td colspan="2">Delivery Address</td></tr>
          <tr><td valign="top">Address</td><td><textarea readonly="readonly"
          cols="20" rows="4" name="address">pobox 10786</textarea></td></tr>
          <tr><td>City</td><td><input type="text" name="city" value="Asmara"
          readonly="readonly"></td></tr>
          <Tr><td>Country</td><td><input type="text" name="country"
          value="Eritrea" readonly="readonly"></td></tr>
          <tr><td>Tele</td><td><input type="text" name="tele" value="152151"
          readonly="readonly"></td></tr>
          <tr><td colspan="2" align="right"><a href="#">Edit
          Address</a></td></tr>
          <tr><td colspan="2">Order Information</td></tr>
          <tr><td colspan="2">
          <table border="1" width="500"><tr><td colspan="2">Car Number
          1</td></tr>
          <tr><td>Car</td><td>Ambulance coaster</td></tr>
          <tr><td>Unit Price</td><td>25000 USD</td></tr>
          <tr><td><input type="hidden" name="U1001AB100001"
          value="25000"><input type="hidden" name="T1001AB100001"
          value="7"></td><td><input type="hidden" name="1001AB100001"
          value="1001AB100001"></td></tr>
          <tr><td>Availiable in Store</td><td>7 Cars</td></tr>
          <tr><td>Order how many</td><td><select name="1001AB100001"
          onClick="setmoney()" onChange="setmoney()"><option value="1">1
          cars</option><option value="2">2 cars</option><option value="3">3
          cars</option><option value="4">4 cars</option><option value="5">5
          cars</option><option value="6">6 cars</option><option value="7">7
          cars</option></select>
          </td></tr>
          <tr><td valign="top">Price</td><td><input type="text"
          readonly="readonly" size="11" name="ttldollar1001AB100001">
          Dollar<br><input type="text" readonly="readonly" size="11"
          name="ttleuro1001AB100001"> Euro<br><input type="text"
          readonly="readonly" size="11" name="ttlnacfa1001AB100001">
          Nacfa</td></tr>
          </table>
          <table border="1" width="500"><tr><td colspan="2">Car Number
          2</td></tr>
          <tr><td>Car</td><td>Ambulance coaster</td></tr>
          <tr><td>Unit Price</td><td>15000 USD</td></tr>
          <tr><td><input type="hidden" name="U1001AB100002"
          value="15000"><input type="hidden" name="T1001AB100002"
          value="42"></td><td><input type="hidden" name="1001AB100002"
          value="1001AB100002"></td></tr>
          <tr><td>Availiable in Store</td><td>42 Cars</td></tr>
          <tr><td>Order how many</td><td><select name="1001AB100002"
          onClick="setmoney()" onChange="setmoney()"><option value="1">1
          cars</option><option value="2">2 cars</option><option value="3">3
          cars</option><option value="4">4 cars</option><option value="5">5
          cars</option><option value="6">6 cars</option><option value="7">7
          cars</option><option value="8">8 cars</option><option value="9">9
          cars</option><option value="10">10 cars</option><option value="11">11
          cars</option><option value="12">12 cars</option><option value="13">13
          cars</option><option value="14">14 cars</option><option value="15">15
          cars</option><option value="16">16 cars</option><option value="17">17
          cars</option><option value="18">18 cars</option><option value="19">19
          cars</option><option value="20">20 cars</option><option value="21">21
          cars</option><option value="22">22 cars</option><option value="23">23
          cars</option><option value="24">24 cars</option><option value="25">25
          cars</option><option value="26">26 cars</option><option value="27">27
          cars</option><option value="28">28 cars</option><option value="29">29
          cars</option><option value="30">30 cars</option><option value="31">31
          cars</option><option value="32">32 cars</option><option value="33">33
          cars</option><option value="34">34 cars</option><option value="35">35
          cars</option><option value="36">36 cars</option><option value="37">37
          cars</option><option value="38">38 cars</option><option value="39">39
          cars</option><option value="40">40 cars</option><option value="41">41
          cars</option><option value="42">42 cars</option></select>
          </td></tr>
          <tr><td valign="top">Price</td><td><input type="text"
          readonly="readonly" size="11" name="ttldollar1001AB100002">
          Dollar<br><input type="text" readonly="readonly" size="11"
          name="ttleuro1001AB100002"> Euro<br><input type="text"
          readonly="readonly" size="11" name="ttlnacfa1001AB100002">
          Nacfa</td></tr>
          </table>

          </td></tr>
          <tr><td colspan="2">Payment Options</td></tr>
          <tr><td>Pay In</td><td><select name="currency" onClick="setmoney();"
          onChange="setmoney();"><option value="Dollar"
          selected="selected">Dollar</option><option
          value="Euro">Euro</option><option
          value="Nacfa">Nacfa</option></select></td></tr>
          <tr><td valign="top">Total Price</td><td><input type="text"
          readonly="readonly" size="11" name="ttldollar"> Dollar<br><input
          type="text" readonly="readonly" size="11" name="ttleuro">
          Euro<br><input type="text" readonly="readonly" size="11"
          name="ttlnacfa"> Nacfa</td></tr>
          <tr><td colspan="2">Payment Method</td></tr>
          <tr><td><input type="radio" name="paymethods[]"
          value="1">Online</td><td>Credit Card<br><select
          name="creditcar"><option value="Visa">Visa</option><option
          value="Master">Master</option><option
          value="Discover">Discover</option></select><br>Card Holder
          Name<br><input type="text" name="cardholdername"><br>Expiry
          Date<br><input type="text" name="expdate"></td></tr>
          <tr><td><input type="radio" name="paymethods[]"
          value="2">Phone</td><td>Phone</td></tr>
          <tr><td><input type="radio" name="paymethods[]"
          value="3">Fax</td><td>FAX</TD></TR>
          <tr><td colspan="2" align="center"><input type="submit" value="Order"
          name="submit"></td></tr>
          </table></form>
          </td>
          <td width="7" height="226" valign="top"></td>
          <td width="196" height="226" valign="top">Rate of
          Exchange:<br>One Dollar=20 Nacfa<br>One Euro=25 Nacfa</td>
          <td width="3" height="226" valign="top"></td>
          </tr>
          <tr>
          <td width="14" height="1" valign="top"><img src="transparent.gif"
          alt="" width="14" height="1"></td>
          <td width="514" height="1" valign="top"><img
          src="transparent.gif" alt="" width="514" height="1"></td>
          <td width="7" height="1" valign="top"><img src="transparent.gif"
          alt="" width="7" height="1"></td>
          <td width="196" height="1" valign="top"><img
          src="transparent.gif" alt="" width="196" height="1"></td>
          <td width="3" height="1" valign="top"><img src="transparent.gif"
          alt="" width="3" height="1"></td>
          </tr>
          </table>
          </body>
          </html>


          '*********************************************************************
          '*********************************************************************

          I hope they are helpful.

          Sami




          --- In JavaScript_Official@yahoogroups.com, Tim Sabin <tim@...> wrote:
          >
          > I've got an idea of what you need, but it's hard to say without
          looking
          > at the code. Please post your entire page (both HTML and
          JavaScript) and
          > let us have a look.
          >
          > --Tim Sabin
          >
          >
          > saminor2002 wrote:
          > > Hi guys,
          > > I am new to this club and hope to find your help as soon as
          possible.
          > > I have an order form, where customers can buy single items or
          multiple
          > > items. It works like this: the company sets the prices in dollar,
          but
          > > users also know the equalivalent in euro. If a customer orders 4
          items
          > > that worth 4dollars, the total is told in both dollar and euro.
          But
          > > when the customer wants to order in bulk, i was not able to do
          the
          > > conversion because the number of textboxes is built dynamically.
          I
          > > need to tell the customer the ttl amount per group of items (e.g.
          CD
          > > roms and dvd roms) and then the total amount of all the items.
          Sorry
          > > my english is not good. Need further explanation, let me know.
          > >
          > > Sami
          > >
          > >
          > >
          > > Visit http://aiaiai.com for more groups to join
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          > >
          >
        • Tim Sabin
          What I see as a problem is that you have defined setmoney () on the first page, but not the second. JavaScript definitions do not carry over from page to page.
          Message 4 of 6 , Dec 3, 2007
          • 0 Attachment
            What I see as a problem is that you have defined setmoney () on the
            first page, but not the second. JavaScript definitions do not carry
            over from page to page. There are 2 ways of handling this: 1)
            duplicate the setmoney () definition in the 2nd page, or 2) put the
            definition in a file on the server (say, setmoney.js) and use this tag
            in each page:
            <script type="text/javascript" src="setmoney.js" />
            and DON'T redefine setmoney () in either page!

            --Tim Sabin


            > Thanks Guys! Here is the code. The first one is which works fine,
            > when a user wants to order a single item. The second one is the one
            > used when a user have to order multiple items which is not working.
            >
            >
            > '********************************************************************
            > '********************************************************************
            > '********************************************************************
            > <html>
            > <head>
            > <script language="javascript" type="text/javascript">
            > function setmoney() {
            >
            document.forms.purchase.ttldollar.value=document.forms.purchase.orderh
            > owmany.value*25000
            >
            document.forms.purchase.ttlnacfa.value=20*document.forms.purchase.ttld
            > ollar.value
            >
            document.forms.purchase.ttleuro.value=document.forms.purchase.ttlnacfa
            > .value/25
            > }
            >
            > </script>
            > <title>Anberbeb Share Company -Buy</title>
            > </head>
            > <body>
            > <table border="0" cellpadding="0" cellspacing="0" width="80%"
            > align="center">
            > <tr>
            > <td width="14" height="32" valign="top"></td>
            > <td width="720" height="32" colspan="4" valign="top">Home
            > Shopcart Currency </td>
            > </tr>
            > <tr>
            > <td width="14" height="29" valign="top"></td>
            > <td width="720" height="29" colspan="4" valign="top"><div
            > align="left"><span class="style3">Secure Order Form
            </span></div></td>
            > </tr>
            > <tr>
            > <td width="14" height="226" valign="top"></td>
            > <td width="514" height="226" valign="top" align="center"><form
            > name="purchase" action="buy.php" method="POST"><table border="1"
            > width="512"><tr><td colspan="2">Delivery Address</td></tr>
            > <tr><td valign="top">Address</td><td><textarea readonly="readonly"
            > cols="20" rows="4" name="address">pobox 10786</textarea></td></tr>
            > <tr><td>City</td><td><input type="text" name="city" value="Asmara"
            > readonly="readonly"></td></tr>
            > <Tr><td>Country</td><td><input type="text" name="country"
            > value="Eritrea" readonly="readonly"></td></tr>
            > <tr><td>Tele</td><td><input type="text" name="tele" value="152151"
            > readonly="readonly"></td></tr>
            > <tr><td colspan="2" align="right"><a href="#">Edit
            > Address</a></td></tr>
            > <tr><td colspan="2">Order Information</td></tr>
            > <tr><td>Car</td><td>Ambulance coaster</td></tr>
            > <tr><td>Unit Price</td><td>25000 USD</td></tr>
            > <tr><td><input type="hidden" name="unitprice" value="25000"><input
            > type="hidden" name="ttlinstore" value="7"></td><td><input
            > type="hidden" name="item" value="S"><input type="hidden" name="c"
            > value="1001AB100001"></td></tr>
            > <tr><td>Availiable in Store</td><td>7 Cars</td></tr>
            > <tr><td>Order how many</td><td><select name="orderhowmany"
            > onClick="setmoney();" onChange="setmoney();"><option value="1">1
            > Cars</option>
            > <option value="2">2 Cars</option>
            > <option value="3">3 Cars</option>
            > <option value="4">4 Cars</option>
            > <option value="5">5 Cars</option>
            > <option value="6">6 Cars</option>
            > <option value="7">7 Cars</option>
            > </select>
            > </td></tr>
            > <tr><td colspan="2">Payment Options</td></tr>
            > <tr><td>Pay In</td><td><select name="currency" onClick="setmoney();"
            > onChange="setmoney();"><option value="Dollar"
            > selected="selected">Dollar</option><option
            > value="Euro">Euro</option><option
            > value="Nacfa">Nacfa</option></select></td></tr>
            > <tr><td valign="top">Total Price</td><td><input type="text"
            > readonly="readonly" size="11" name="ttldollar"> Dollar<br><input
            > type="text" readonly="readonly" size="11" name="ttleuro">
            > Euro<br><input type="text" readonly="readonly" size="11"
            > name="ttlnacfa"> Nacfa</td></tr>
            > <tr><td colspan="2">Payment Method</td></tr>
            > <tr><td><input type="radio" name="paymethods[]"
            > value="1">Online</td><td>Credit Card<br><select
            > name="creditcar"><option value="Visa">Visa</option><option
            > value="Master">Master</option><option
            > value="Discover">Discover</option></select><br>Card Holder
            > Name<br><input type="text" name="cardholdername"><br>Expiry
            > Date<br><input type="text" name="expdate"></td></tr>
            > <tr><td><input type="radio" name="paymethods[]"
            > value="2">Phone</td><td>Phone</td></tr>
            > <tr><td><input type="radio" name="paymethods[]"
            > value="3">Fax</td><td>FAX</TD></TR>
            > <tr><td colspan="2" align="center"><input type="submit"
            value="Order"
            > name="submit"></td></tr>
            > </table></form>
            > </td>
            > <td width="7" height="226" valign="top"></td>
            > <td width="196" height="226" valign="top">Rate of
            > Exchange:<br>One Dollar=20 Nacfa<br>One Euro=25 Nacfa</td>
            > <td width="3" height="226" valign="top"></td>
            > </tr>
            > <tr>
            > <td width="14" height="1" valign="top"><img
            src="transparent.gif"
            > alt="" width="14" height="1"></td>
            > <td width="514" height="1" valign="top"><img
            > src="transparent.gif" alt="" width="514" height="1"></td>
            > <td width="7" height="1" valign="top"><img src="transparent.gif"
            > alt="" width="7" height="1"></td>
            > <td width="196" height="1" valign="top"><img
            > src="transparent.gif" alt="" width="196" height="1"></td>
            > <td width="3" height="1" valign="top"><img src="transparent.gif"
            > alt="" width="3" height="1"></td>
            > </tr>
            > </table>
            > </body>
            > </html>
            >
            >
            > '*******************************************************************
            > '********************************************************************
            *
            >
            **********************************************************************
            > *
            >
            > SECOND FILE
            >
            > '********************************************************************
            > '******************************************************************
            > '********************************************************************
            >
            > <html>
            > <head>
            > <script language="javascript" type="text/javascript">
            >
            > </script>
            > <title>Anberbeb Share Company -Buy</title>
            >
            > </head>
            > <body>
            > <table border="0" cellpadding="0" cellspacing="0" width="80%"
            > align="center">
            > <tr>
            > <td width="14" height="32" valign="top"></td>
            > <td width="720" height="32" colspan="4" valign="top">Home
            > Shopcart Currency </td>
            > </tr>
            > <tr>
            > <td width="14" height="29" valign="top"></td>
            > <td width="720" height="29" colspan="4" valign="top"><div
            > align="left"><span class="style3">Secure Order Form
            </span></div></td>
            > </tr>
            > <tr>
            > <td width="14" height="226" valign="top"></td>
            > <td width="514" height="226" valign="top" align="center"><form
            > name="purchase" action="buy.php" method="POST"><table border="1"
            > width="512"><tr><td colspan="2">Delivery Address</td></tr>
            > <tr><td valign="top">Address</td><td><textarea readonly="readonly"
            > cols="20" rows="4" name="address">pobox 10786</textarea></td></tr>
            > <tr><td>City</td><td><input type="text" name="city" value="Asmara"
            > readonly="readonly"></td></tr>
            > <Tr><td>Country</td><td><input type="text" name="country"
            > value="Eritrea" readonly="readonly"></td></tr>
            > <tr><td>Tele</td><td><input type="text" name="tele" value="152151"
            > readonly="readonly"></td></tr>
            > <tr><td colspan="2" align="right"><a href="#">Edit
            > Address</a></td></tr>
            > <tr><td colspan="2">Order Information</td></tr>
            > <tr><td colspan="2">
            > <table border="1" width="500"><tr><td colspan="2">Car Number
            > 1</td></tr>
            > <tr><td>Car</td><td>Ambulance coaster</td></tr>
            > <tr><td>Unit Price</td><td>25000 USD</td></tr>
            > <tr><td><input type="hidden" name="U1001AB100001"
            > value="25000"><input type="hidden" name="T1001AB100001"
            > value="7"></td><td><input type="hidden" name="1001AB100001"
            > value="1001AB100001"></td></tr>
            > <tr><td>Availiable in Store</td><td>7 Cars</td></tr>
            > <tr><td>Order how many</td><td><select name="1001AB100001"
            > onClick="setmoney()" onChange="setmoney()"><option value="1">1
            > cars</option><option value="2">2 cars</option><option value="3">3
            > cars</option><option value="4">4 cars</option><option value="5">5
            > cars</option><option value="6">6 cars</option><option value="7">7
            > cars</option></select>
            > </td></tr>
            > <tr><td valign="top">Price</td><td><input type="text"
            > readonly="readonly" size="11" name="ttldollar1001AB100001">
            > Dollar<br><input type="text" readonly="readonly" size="11"
            > name="ttleuro1001AB100001"> Euro<br><input type="text"
            > readonly="readonly" size="11" name="ttlnacfa1001AB100001">
            > Nacfa</td></tr>
            > </table>
            > <table border="1" width="500"><tr><td colspan="2">Car Number
            > 2</td></tr>
            > <tr><td>Car</td><td>Ambulance coaster</td></tr>
            > <tr><td>Unit Price</td><td>15000 USD</td></tr>
            > <tr><td><input type="hidden" name="U1001AB100002"
            > value="15000"><input type="hidden" name="T1001AB100002"
            > value="42"></td><td><input type="hidden" name="1001AB100002"
            > value="1001AB100002"></td></tr>
            > <tr><td>Availiable in Store</td><td>42 Cars</td></tr>
            > <tr><td>Order how many</td><td><select name="1001AB100002"
            > onClick="setmoney()" onChange="setmoney()"><option value="1">1
            > cars</option><option value="2">2 cars</option><option value="3">3
            > cars</option><option value="4">4 cars</option><option value="5">5
            > cars</option><option value="6">6 cars</option><option value="7">7
            > cars</option><option value="8">8 cars</option><option value="9">9
            > cars</option><option value="10">10 cars</option><option
            value="11">11
            > cars</option><option value="12">12 cars</option><option
            value="13">13
            > cars</option><option value="14">14 cars</option><option
            value="15">15
            > cars</option><option value="16">16 cars</option><option
            value="17">17
            > cars</option><option value="18">18 cars</option><option
            value="19">19
            > cars</option><option value="20">20 cars</option><option
            value="21">21
            > cars</option><option value="22">22 cars</option><option
            value="23">23
            > cars</option><option value="24">24 cars</option><option
            value="25">25
            > cars</option><option value="26">26 cars</option><option
            value="27">27
            > cars</option><option value="28">28 cars</option><option
            value="29">29
            > cars</option><option value="30">30 cars</option><option
            value="31">31
            > cars</option><option value="32">32 cars</option><option
            value="33">33
            > cars</option><option value="34">34 cars</option><option
            value="35">35
            > cars</option><option value="36">36 cars</option><option
            value="37">37
            > cars</option><option value="38">38 cars</option><option
            value="39">39
            > cars</option><option value="40">40 cars</option><option
            value="41">41
            > cars</option><option value="42">42 cars</option></select>
            > </td></tr>
            > <tr><td valign="top">Price</td><td><input type="text"
            > readonly="readonly" size="11" name="ttldollar1001AB100002">
            > Dollar<br><input type="text" readonly="readonly" size="11"
            > name="ttleuro1001AB100002"> Euro<br><input type="text"
            > readonly="readonly" size="11" name="ttlnacfa1001AB100002">
            > Nacfa</td></tr>
            > </table>
            >
            > </td></tr>
            > <tr><td colspan="2">Payment Options</td></tr>
            > <tr><td>Pay In</td><td><select name="currency" onClick="setmoney();"
            > onChange="setmoney();"><option value="Dollar"
            > selected="selected">Dollar</option><option
            > value="Euro">Euro</option><option
            > value="Nacfa">Nacfa</option></select></td></tr>
            > <tr><td valign="top">Total Price</td><td><input type="text"
            > readonly="readonly" size="11" name="ttldollar"> Dollar<br><input
            > type="text" readonly="readonly" size="11" name="ttleuro">
            > Euro<br><input type="text" readonly="readonly" size="11"
            > name="ttlnacfa"> Nacfa</td></tr>
            > <tr><td colspan="2">Payment Method</td></tr>
            > <tr><td><input type="radio" name="paymethods[]"
            > value="1">Online</td><td>Credit Card<br><select
            > name="creditcar"><option value="Visa">Visa</option><option
            > value="Master">Master</option><option
            > value="Discover">Discover</option></select><br>Card Holder
            > Name<br><input type="text" name="cardholdername"><br>Expiry
            > Date<br><input type="text" name="expdate"></td></tr>
            > <tr><td><input type="radio" name="paymethods[]"
            > value="2">Phone</td><td>Phone</td></tr>
            > <tr><td><input type="radio" name="paymethods[]"
            > value="3">Fax</td><td>FAX</TD></TR>
            > <tr><td colspan="2" align="center"><input type="submit"
            value="Order"
            > name="submit"></td></tr>
            > </table></form>
            > </td>
            > <td width="7" height="226" valign="top"></td>
            > <td width="196" height="226" valign="top">Rate of
            > Exchange:<br>One Dollar=20 Nacfa<br>One Euro=25 Nacfa</td>
            > <td width="3" height="226" valign="top"></td>
            > </tr>
            > <tr>
            > <td width="14" height="1" valign="top"><img
            src="transparent.gif"
            > alt="" width="14" height="1"></td>
            > <td width="514" height="1" valign="top"><img
            > src="transparent.gif" alt="" width="514" height="1"></td>
            > <td width="7" height="1" valign="top"><img src="transparent.gif"
            > alt="" width="7" height="1"></td>
            > <td width="196" height="1" valign="top"><img
            > src="transparent.gif" alt="" width="196" height="1"></td>
            > <td width="3" height="1" valign="top"><img src="transparent.gif"
            > alt="" width="3" height="1"></td>
            > </tr>
            > </table>
            > </body>
            > </html>
            >
            >
            > '********************************************************************
            *
            > '********************************************************************
            *
            >
            > I hope they are helpful.
            >
            > Sami
            >
            >
            >
            >
            > --- In JavaScript_Official@yahoogroups.com, Tim Sabin <tim@...>
            wrote:
            > >
            > > I've got an idea of what you need, but it's hard to say without
            > looking
            > > at the code. Please post your entire page (both HTML and
            > JavaScript) and
            > > let us have a look.
            > >
            > > --Tim Sabin
            > >
            > >
            > > saminor2002 wrote:
            > > > Hi guys,
            > > > I am new to this club and hope to find your help as soon as
            > possible.
            > > > I have an order form, where customers can buy single items or
            > multiple
            > > > items. It works like this: the company sets the prices in
            dollar,
            > but
            > > > users also know the equalivalent in euro. If a customer orders 4
            > items
            > > > that worth 4dollars, the total is told in both dollar and euro.
            > But
            > > > when the customer wants to order in bulk, i was not able to do
            > the
            > > > conversion because the number of textboxes is built dynamically.
            > I
            > > > need to tell the customer the ttl amount per group of items
            (e.g.
            > CD
            > > > roms and dvd roms) and then the total amount of all the items.
            > Sorry
            > > > my english is not good. Need further explanation, let me know.
            > > >
            > > > Sami
            > > >
            > > >
            > > >
            > > > Visit http://aiaiai.com for more groups to join
            > > > Yahoo! Groups Links
            > > >
            > > >
            > > >
            > > >
            > > >
            > > >
            > >
            >
            >
            >
            >
            > Visit http://aiaiai.com for more groups to join
            > Yahoo! Groups Links
            >
            >
            >
            >
            >

            --Tim Sabin
          • saminor2002
            Thanks Tim Actually, by 1st file and 2nd file, i mean the phases. Let me explain it all: When a customer orders a single item, the first code is displayed. It
            Message 5 of 6 , Dec 4, 2007
            • 0 Attachment
              Thanks Tim
              Actually, by 1st file and 2nd file, i mean the phases. Let me explain
              it all:
              When a customer orders a single item, the first code is displayed. It
              works just fine, because i know the textboxes name.
              But if the customer orders multiple items (he can order any number of
              items), i have to build the textboxes from run time. Now, how can I
              just refer to those dynamically made textboxes and use them in the
              setmoney function? The setmoney function accepts a textbox whose name
              starts with a dlr. After accepting that value, the function converts
              it to euro and nacfa? So, it tells the user the amount in euro andn
              nacfa (a currency type) for each item. At the end, i need a sum of
              the items in a textbox too. I hope you have got my idea. It is an
              onlineshop program by the way.

              THANKS AGAIN.

              SAMI



              --- In JavaScript_Official@yahoogroups.com, "Tim Sabin" <tim@...>
              wrote:
              >
              > What I see as a problem is that you have defined setmoney () on the
              > first page, but not the second. JavaScript definitions do not carry
              > over from page to page. There are 2 ways of handling this: 1)
              > duplicate the setmoney () definition in the 2nd page, or 2) put the
              > definition in a file on the server (say, setmoney.js) and use this
              tag
              > in each page:
              > <script type="text/javascript" src="setmoney.js" />
              > and DON'T redefine setmoney () in either page!
              >
              > --Tim Sabin
              >
              >
              > > Thanks Guys! Here is the code. The first one is which works fine,
              > > when a user wants to order a single item. The second one is the
              one
              > > used when a user have to order multiple items which is not
              working.
              > >
              > >
              >
              > '*******************************************************************
              *
              >
              > '*******************************************************************
              *
              >
              > '*******************************************************************
              *
              > > <html>
              > > <head>
              > > <script language="javascript" type="text/javascript">
              > > function setmoney() {
              > >
              >
              document.forms.purchase.ttldollar.value=document.forms.purchase.orderh
              > > owmany.value*25000
              > >
              >
              document.forms.purchase.ttlnacfa.value=20*document.forms.purchase.ttld
              > > ollar.value
              > >
              >
              document.forms.purchase.ttleuro.value=document.forms.purchase.ttlnacfa
              > > .value/25
              > > }
              > >
              > > </script>
              > > <title>Anberbeb Share Company -Buy</title>
              > > </head>
              > > <body>
              > > <table border="0" cellpadding="0" cellspacing="0" width="80%"
              > > align="center">
              > > <tr>
              > > <td width="14" height="32" valign="top"></td>
              > > <td width="720" height="32" colspan="4" valign="top">Home
              > > Shopcart Currency </td>
              > > </tr>
              > > <tr>
              > > <td width="14" height="29" valign="top"></td>
              > > <td width="720" height="29" colspan="4" valign="top"><div
              > > align="left"><span class="style3">Secure Order Form
              > </span></div></td>
              > > </tr>
              > > <tr>
              > > <td width="14" height="226" valign="top"></td>
              > > <td width="514" height="226" valign="top"
              align="center"><form
              > > name="purchase" action="buy.php" method="POST"><table border="1"
              > > width="512"><tr><td colspan="2">Delivery Address</td></tr>
              > > <tr><td valign="top">Address</td><td><textarea
              readonly="readonly"
              > > cols="20" rows="4" name="address">pobox 10786</textarea></td></tr>
              > > <tr><td>City</td><td><input type="text" name="city"
              value="Asmara"
              > > readonly="readonly"></td></tr>
              > > <Tr><td>Country</td><td><input type="text" name="country"
              > > value="Eritrea" readonly="readonly"></td></tr>
              > > <tr><td>Tele</td><td><input type="text" name="tele"
              value="152151"
              > > readonly="readonly"></td></tr>
              > > <tr><td colspan="2" align="right"><a href="#">Edit
              > > Address</a></td></tr>
              > > <tr><td colspan="2">Order Information</td></tr>
              > > <tr><td>Car</td><td>Ambulance coaster</td></tr>
              > > <tr><td>Unit Price</td><td>25000 USD</td></tr>
              > > <tr><td><input type="hidden" name="unitprice"
              value="25000"><input
              > > type="hidden" name="ttlinstore" value="7"></td><td><input
              > > type="hidden" name="item" value="S"><input type="hidden" name="c"
              > > value="1001AB100001"></td></tr>
              > > <tr><td>Availiable in Store</td><td>7 Cars</td></tr>
              > > <tr><td>Order how many</td><td><select name="orderhowmany"
              > > onClick="setmoney();" onChange="setmoney();"><option value="1">1
              > > Cars</option>
              > > <option value="2">2 Cars</option>
              > > <option value="3">3 Cars</option>
              > > <option value="4">4 Cars</option>
              > > <option value="5">5 Cars</option>
              > > <option value="6">6 Cars</option>
              > > <option value="7">7 Cars</option>
              > > </select>
              > > </td></tr>
              > > <tr><td colspan="2">Payment Options</td></tr>
              > > <tr><td>Pay In</td><td><select name="currency" onClick="setmoney
              ();"
              > > onChange="setmoney();"><option value="Dollar"
              > > selected="selected">Dollar</option><option
              > > value="Euro">Euro</option><option
              > > value="Nacfa">Nacfa</option></select></td></tr>
              > > <tr><td valign="top">Total Price</td><td><input type="text"
              > > readonly="readonly" size="11" name="ttldollar"> Dollar<br><input
              > > type="text" readonly="readonly" size="11" name="ttleuro">
              > > Euro<br><input type="text" readonly="readonly" size="11"
              > > name="ttlnacfa"> Nacfa</td></tr>
              > > <tr><td colspan="2">Payment Method</td></tr>
              > > <tr><td><input type="radio" name="paymethods[]"
              > > value="1">Online</td><td>Credit Card<br><select
              > > name="creditcar"><option value="Visa">Visa</option><option
              > > value="Master">Master</option><option
              > > value="Discover">Discover</option></select><br>Card Holder
              > > Name<br><input type="text" name="cardholdername"><br>Expiry
              > > Date<br><input type="text" name="expdate"></td></tr>
              > > <tr><td><input type="radio" name="paymethods[]"
              > > value="2">Phone</td><td>Phone</td></tr>
              > > <tr><td><input type="radio" name="paymethods[]"
              > > value="3">Fax</td><td>FAX</TD></TR>
              > > <tr><td colspan="2" align="center"><input type="submit"
              > value="Order"
              > > name="submit"></td></tr>
              > > </table></form>
              > > </td>
              > > <td width="7" height="226" valign="top"></td>
              > > <td width="196" height="226" valign="top">Rate of
              > > Exchange:<br>One Dollar=20 Nacfa<br>One Euro=25 Nacfa</td>
              > > <td width="3" height="226" valign="top"></td>
              > > </tr>
              > > <tr>
              > > <td width="14" height="1" valign="top"><img
              > src="transparent.gif"
              > > alt="" width="14" height="1"></td>
              > > <td width="514" height="1" valign="top"><img
              > > src="transparent.gif" alt="" width="514" height="1"></td>
              > > <td width="7" height="1" valign="top"><img
              src="transparent.gif"
              > > alt="" width="7" height="1"></td>
              > > <td width="196" height="1" valign="top"><img
              > > src="transparent.gif" alt="" width="196" height="1"></td>
              > > <td width="3" height="1" valign="top"><img
              src="transparent.gif"
              > > alt="" width="3" height="1"></td>
              > > </tr>
              > > </table>
              > > </body>
              > > </html>
              > >
              > >
              >
              > '*******************************************************************
              >
              > '*******************************************************************
              *
              > *
              > >
              >
              **********************************************************************
              > > *
              > >
              > > SECOND FILE
              > >
              >
              > '*******************************************************************
              *
              >
              > '******************************************************************
              >
              > '*******************************************************************
              *
              > >
              > > <html>
              > > <head>
              > > <script language="javascript" type="text/javascript">
              > >
              > > </script>
              > > <title>Anberbeb Share Company -Buy</title>
              > >
              > > </head>
              > > <body>
              > > <table border="0" cellpadding="0" cellspacing="0" width="80%"
              > > align="center">
              > > <tr>
              > > <td width="14" height="32" valign="top"></td>
              > > <td width="720" height="32" colspan="4" valign="top">Home
              > > Shopcart Currency </td>
              > > </tr>
              > > <tr>
              > > <td width="14" height="29" valign="top"></td>
              > > <td width="720" height="29" colspan="4" valign="top"><div
              > > align="left"><span class="style3">Secure Order Form
              > </span></div></td>
              > > </tr>
              > > <tr>
              > > <td width="14" height="226" valign="top"></td>
              > > <td width="514" height="226" valign="top"
              align="center"><form
              > > name="purchase" action="buy.php" method="POST"><table border="1"
              > > width="512"><tr><td colspan="2">Delivery Address</td></tr>
              > > <tr><td valign="top">Address</td><td><textarea
              readonly="readonly"
              > > cols="20" rows="4" name="address">pobox 10786</textarea></td></tr>
              > > <tr><td>City</td><td><input type="text" name="city"
              value="Asmara"
              > > readonly="readonly"></td></tr>
              > > <Tr><td>Country</td><td><input type="text" name="country"
              > > value="Eritrea" readonly="readonly"></td></tr>
              > > <tr><td>Tele</td><td><input type="text" name="tele"
              value="152151"
              > > readonly="readonly"></td></tr>
              > > <tr><td colspan="2" align="right"><a href="#">Edit
              > > Address</a></td></tr>
              > > <tr><td colspan="2">Order Information</td></tr>
              > > <tr><td colspan="2">
              > > <table border="1" width="500"><tr><td colspan="2">Car Number
              > > 1</td></tr>
              > > <tr><td>Car</td><td>Ambulance coaster</td></tr>
              > > <tr><td>Unit Price</td><td>25000 USD</td></tr>
              > > <tr><td><input type="hidden" name="U1001AB100001"
              > > value="25000"><input type="hidden" name="T1001AB100001"
              > > value="7"></td><td><input type="hidden" name="1001AB100001"
              > > value="1001AB100001"></td></tr>
              > > <tr><td>Availiable in Store</td><td>7 Cars</td></tr>
              > > <tr><td>Order how many</td><td><select name="1001AB100001"
              > > onClick="setmoney()" onChange="setmoney()"><option value="1">1
              > > cars</option><option value="2">2 cars</option><option value="3">3
              > > cars</option><option value="4">4 cars</option><option value="5">5
              > > cars</option><option value="6">6 cars</option><option value="7">7
              > > cars</option></select>
              > > </td></tr>
              > > <tr><td valign="top">Price</td><td><input type="text"
              > > readonly="readonly" size="11" name="ttldollar1001AB100001">
              > > Dollar<br><input type="text" readonly="readonly" size="11"
              > > name="ttleuro1001AB100001"> Euro<br><input type="text"
              > > readonly="readonly" size="11" name="ttlnacfa1001AB100001">
              > > Nacfa</td></tr>
              > > </table>
              > > <table border="1" width="500"><tr><td colspan="2">Car Number
              > > 2</td></tr>
              > > <tr><td>Car</td><td>Ambulance coaster</td></tr>
              > > <tr><td>Unit Price</td><td>15000 USD</td></tr>
              > > <tr><td><input type="hidden" name="U1001AB100002"
              > > value="15000"><input type="hidden" name="T1001AB100002"
              > > value="42"></td><td><input type="hidden" name="1001AB100002"
              > > value="1001AB100002"></td></tr>
              > > <tr><td>Availiable in Store</td><td>42 Cars</td></tr>
              > > <tr><td>Order how many</td><td><select name="1001AB100002"
              > > onClick="setmoney()" onChange="setmoney()"><option value="1">1
              > > cars</option><option value="2">2 cars</option><option value="3">3
              > > cars</option><option value="4">4 cars</option><option value="5">5
              > > cars</option><option value="6">6 cars</option><option value="7">7
              > > cars</option><option value="8">8 cars</option><option value="9">9
              > > cars</option><option value="10">10 cars</option><option
              > value="11">11
              > > cars</option><option value="12">12 cars</option><option
              > value="13">13
              > > cars</option><option value="14">14 cars</option><option
              > value="15">15
              > > cars</option><option value="16">16 cars</option><option
              > value="17">17
              > > cars</option><option value="18">18 cars</option><option
              > value="19">19
              > > cars</option><option value="20">20 cars</option><option
              > value="21">21
              > > cars</option><option value="22">22 cars</option><option
              > value="23">23
              > > cars</option><option value="24">24 cars</option><option
              > value="25">25
              > > cars</option><option value="26">26 cars</option><option
              > value="27">27
              > > cars</option><option value="28">28 cars</option><option
              > value="29">29
              > > cars</option><option value="30">30 cars</option><option
              > value="31">31
              > > cars</option><option value="32">32 cars</option><option
              > value="33">33
              > > cars</option><option value="34">34 cars</option><option
              > value="35">35
              > > cars</option><option value="36">36 cars</option><option
              > value="37">37
              > > cars</option><option value="38">38 cars</option><option
              > value="39">39
              > > cars</option><option value="40">40 cars</option><option
              > value="41">41
              > > cars</option><option value="42">42 cars</option></select>
              > > </td></tr>
              > > <tr><td valign="top">Price</td><td><input type="text"
              > > readonly="readonly" size="11" name="ttldollar1001AB100002">
              > > Dollar<br><input type="text" readonly="readonly" size="11"
              > > name="ttleuro1001AB100002"> Euro<br><input type="text"
              > > readonly="readonly" size="11" name="ttlnacfa1001AB100002">
              > > Nacfa</td></tr>
              > > </table>
              > >
              > > </td></tr>
              > > <tr><td colspan="2">Payment Options</td></tr>
              > > <tr><td>Pay In</td><td><select name="currency" onClick="setmoney
              ();"
              > > onChange="setmoney();"><option value="Dollar"
              > > selected="selected">Dollar</option><option
              > > value="Euro">Euro</option><option
              > > value="Nacfa">Nacfa</option></select></td></tr>
              > > <tr><td valign="top">Total Price</td><td><input type="text"
              > > readonly="readonly" size="11" name="ttldollar"> Dollar<br><input
              > > type="text" readonly="readonly" size="11" name="ttleuro">
              > > Euro<br><input type="text" readonly="readonly" size="11"
              > > name="ttlnacfa"> Nacfa</td></tr>
              > > <tr><td colspan="2">Payment Method</td></tr>
              > > <tr><td><input type="radio" name="paymethods[]"
              > > value="1">Online</td><td>Credit Card<br><select
              > > name="creditcar"><option value="Visa">Visa</option><option
              > > value="Master">Master</option><option
              > > value="Discover">Discover</option></select><br>Card Holder
              > > Name<br><input type="text" name="cardholdername"><br>Expiry
              > > Date<br><input type="text" name="expdate"></td></tr>
              > > <tr><td><input type="radio" name="paymethods[]"
              > > value="2">Phone</td><td>Phone</td></tr>
              > > <tr><td><input type="radio" name="paymethods[]"
              > > value="3">Fax</td><td>FAX</TD></TR>
              > > <tr><td colspan="2" align="center"><input type="submit"
              > value="Order"
              > > name="submit"></td></tr>
              > > </table></form>
              > > </td>
              > > <td width="7" height="226" valign="top"></td>
              > > <td width="196" height="226" valign="top">Rate of
              > > Exchange:<br>One Dollar=20 Nacfa<br>One Euro=25 Nacfa</td>
              > > <td width="3" height="226" valign="top"></td>
              > > </tr>
              > > <tr>
              > > <td width="14" height="1" valign="top"><img
              > src="transparent.gif"
              > > alt="" width="14" height="1"></td>
              > > <td width="514" height="1" valign="top"><img
              > > src="transparent.gif" alt="" width="514" height="1"></td>
              > > <td width="7" height="1" valign="top"><img
              src="transparent.gif"
              > > alt="" width="7" height="1"></td>
              > > <td width="196" height="1" valign="top"><img
              > > src="transparent.gif" alt="" width="196" height="1"></td>
              > > <td width="3" height="1" valign="top"><img
              src="transparent.gif"
              > > alt="" width="3" height="1"></td>
              > > </tr>
              > > </table>
              > > </body>
              > > </html>
              > >
              > >
              >
              > '*******************************************************************
              *
              > *
              >
              > '*******************************************************************
              *
              > *
              > >
              > > I hope they are helpful.
              > >
              > > Sami
              > >
              > >
              > >
              > >
              > > --- In JavaScript_Official@yahoogroups.com, Tim Sabin <tim@>
              > wrote:
              > > >
              > > > I've got an idea of what you need, but it's hard to say without
              > > looking
              > > > at the code. Please post your entire page (both HTML and
              > > JavaScript) and
              > > > let us have a look.
              > > >
              > > > --Tim Sabin
              > > >
              > > >
              > > > saminor2002 wrote:
              > > > > Hi guys,
              > > > > I am new to this club and hope to find your help as soon as
              > > possible.
              > > > > I have an order form, where customers can buy single items or
              > > multiple
              > > > > items. It works like this: the company sets the prices in
              > dollar,
              > > but
              > > > > users also know the equalivalent in euro. If a customer
              orders 4
              > > items
              > > > > that worth 4dollars, the total is told in both dollar and
              euro.
              > > But
              > > > > when the customer wants to order in bulk, i was not able to
              do
              > > the
              > > > > conversion because the number of textboxes is built
              dynamically.
              > > I
              > > > > need to tell the customer the ttl amount per group of items
              > (e.g.
              > > CD
              > > > > roms and dvd roms) and then the total amount of all the
              items.
              > > Sorry
              > > > > my english is not good. Need further explanation, let me know.
              > > > >
              > > > > Sami
              > > > >
              > > > >
              > > > >
              > > > > Visit http://aiaiai.com for more groups to join
              > > > > Yahoo! Groups Links
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > >
              > >
              > >
              > >
              > >
              > > Visit http://aiaiai.com for more groups to join
              > > Yahoo! Groups Links
              > >
              > >
              > >
              > >
              > >
              >
              > --Tim Sabin
              >
            • Tim Sabin
              So, do I understand correctly that these 2 phases are actually 1 file? My suggestions: 1) Get rid of the single item phase . This is because single item
              Message 6 of 6 , Dec 4, 2007
              • 0 Attachment
                So, do I understand correctly that these 2 "phases" are actually 1
                file?

                My suggestions:
                1) Get rid of the "single item phase". This is because "single item"
                is just a special case of "multiple item" where number-of-items = 1.
                2) Use a number to create the text box names. For example: dlr0txt.
                Access them thus:
                var numItems = 7;
                var i;
                var dlrSum = 0.0;
                var euroSum = 0.0;
                var nacfaSum = 0.0
                var euroConversion = xx.xx;
                var nacfaConversion = xx.xx;
                for (i = 0; i < numItems; i++) {
                dlrSum = dlrSum + eval ('document.myForm.dlr' + i + 'txt.value');
                }
                euroSum = dlrSum * euroConversion;
                nacfaSum = dlrSum * nacfaConversion;

                > Thanks Tim
                > Actually, by 1st file and 2nd file, i mean the phases. Let me
                explain
                > it all:
                > When a customer orders a single item, the first code is displayed.
                It
                > works just fine, because i know the textboxes name.
                > But if the customer orders multiple items (he can order any number
                of
                > items), i have to build the textboxes from run time. Now, how can I
                > just refer to those dynamically made textboxes and use them in the
                > setmoney function? The setmoney function accepts a textbox whose
                name
                > starts with a dlr. After accepting that value, the function converts
                > it to euro and nacfa? So, it tells the user the amount in euro andn
                > nacfa (a currency type) for each item. At the end, i need a sum of
                > the items in a textbox too. I hope you have got my idea. It is an
                > onlineshop program by the way.
                >
                > THANKS AGAIN.
                >
                > SAMI
                >
                >
                >
                > --- In JavaScript_Official@yahoogroups.com, "Tim Sabin" <tim@...>
                > wrote:
                > >
                > > What I see as a problem is that you have defined setmoney () on
                the
                > > first page, but not the second. JavaScript definitions do not
                carry
                > > over from page to page. There are 2 ways of handling this: 1)
                > > duplicate the setmoney () definition in the 2nd page, or 2) put
                the
                > > definition in a file on the server (say, setmoney.js) and use this
                > tag
                > > in each page:
                > > <script type="text/javascript" src="setmoney.js" />
                > > and DON'T redefine setmoney () in either page!
                > >
                > > --Tim Sabin
                > >
                > >
                > > > Thanks Guys! Here is the code. The first one is which works
                fine,
                > > > when a user wants to order a single item. The second one is the
                > one
                > > > used when a user have to order multiple items which is not
                > working.
                > > >
                > > >
                > >
                >
                > '*******************************************************************
                > *
                > >
                >
                > '*******************************************************************
                > *
                > >
                >
                > '*******************************************************************
                > *
                > > > <html>
                > > > <head>
                > > > <script language="javascript" type="text/javascript">
                > > > function setmoney() {
                > > >
                > >
                >
                document.forms.purchase.ttldollar.value=document.forms.purchase.orderh
                > > > owmany.value*25000
                > > >
                > >
                >
                document.forms.purchase.ttlnacfa.value=20*document.forms.purchase.ttld
                > > > ollar.value
                > > >
                > >
                >
                document.forms.purchase.ttleuro.value=document.forms.purchase.ttlnacfa
                > > > .value/25
                > > > }
                > > >
                > > > </script>
                > > > <title>Anberbeb Share Company -Buy</title>
                > > > </head>
                > > > <body>
                > > > <table border="0" cellpadding="0" cellspacing="0" width="80%"
                > > > align="center">
                > > > <tr>
                > > > <td width="14" height="32" valign="top"></td>
                > > > <td width="720" height="32" colspan="4" valign="top">Home
                > > > Shopcart Currency </td>
                > > > </tr>
                > > > <tr>
                > > > <td width="14" height="29" valign="top"></td>
                > > > <td width="720" height="29" colspan="4" valign="top"><div
                > > > align="left"><span class="style3">Secure Order Form
                > > </span></div></td>
                > > > </tr>
                > > > <tr>
                > > > <td width="14" height="226" valign="top"></td>
                > > > <td width="514" height="226" valign="top"
                > align="center"><form
                > > > name="purchase" action="buy.php" method="POST"><table border="1"
                > > > width="512"><tr><td colspan="2">Delivery Address</td></tr>
                > > > <tr><td valign="top">Address</td><td><textarea
                > readonly="readonly"
                > > > cols="20" rows="4" name="address">pobox
                10786</textarea></td></tr>
                > > > <tr><td>City</td><td><input type="text" name="city"
                > value="Asmara"
                > > > readonly="readonly"></td></tr>
                > > > <Tr><td>Country</td><td><input type="text" name="country"
                > > > value="Eritrea" readonly="readonly"></td></tr>
                > > > <tr><td>Tele</td><td><input type="text" name="tele"
                > value="152151"
                > > > readonly="readonly"></td></tr>
                > > > <tr><td colspan="2" align="right"><a href="#">Edit
                > > > Address</a></td></tr>
                > > > <tr><td colspan="2">Order Information</td></tr>
                > > > <tr><td>Car</td><td>Ambulance coaster</td></tr>
                > > > <tr><td>Unit Price</td><td>25000 USD</td></tr>
                > > > <tr><td><input type="hidden" name="unitprice"
                > value="25000"><input
                > > > type="hidden" name="ttlinstore" value="7"></td><td><input
                > > > type="hidden" name="item" value="S"><input type="hidden"
                name="c"
                > > > value="1001AB100001"></td></tr>
                > > > <tr><td>Availiable in Store</td><td>7 Cars</td></tr>
                > > > <tr><td>Order how many</td><td><select name="orderhowmany"
                > > > onClick="setmoney();" onChange="setmoney();"><option value="1">1
                > > > Cars</option>
                > > > <option value="2">2 Cars</option>
                > > > <option value="3">3 Cars</option>
                > > > <option value="4">4 Cars</option>
                > > > <option value="5">5 Cars</option>
                > > > <option value="6">6 Cars</option>
                > > > <option value="7">7 Cars</option>
                > > > </select>
                > > > </td></tr>
                > > > <tr><td colspan="2">Payment Options</td></tr>
                > > > <tr><td>Pay In</td><td><select name="currency" onClick="setmoney
                > ();"
                > > > onChange="setmoney();"><option value="Dollar"
                > > > selected="selected">Dollar</option><option
                > > > value="Euro">Euro</option><option
                > > > value="Nacfa">Nacfa</option></select></td></tr>
                > > > <tr><td valign="top">Total Price</td><td><input type="text"
                > > > readonly="readonly" size="11" name="ttldollar"> Dollar<br><input
                > > > type="text" readonly="readonly" size="11" name="ttleuro">
                > > > Euro<br><input type="text" readonly="readonly" size="11"
                > > > name="ttlnacfa"> Nacfa</td></tr>
                > > > <tr><td colspan="2">Payment Method</td></tr>
                > > > <tr><td><input type="radio" name="paymethods[]"
                > > > value="1">Online</td><td>Credit Card<br><select
                > > > name="creditcar"><option value="Visa">Visa</option><option
                > > > value="Master">Master</option><option
                > > > value="Discover">Discover</option></select><br>Card Holder
                > > > Name<br><input type="text" name="cardholdername"><br>Expiry
                > > > Date<br><input type="text" name="expdate"></td></tr>
                > > > <tr><td><input type="radio" name="paymethods[]"
                > > > value="2">Phone</td><td>Phone</td></tr>
                > > > <tr><td><input type="radio" name="paymethods[]"
                > > > value="3">Fax</td><td>FAX</TD></TR>
                > > > <tr><td colspan="2" align="center"><input type="submit"
                > > value="Order"
                > > > name="submit"></td></tr>
                > > > </table></form>
                > > > </td>
                > > > <td width="7" height="226" valign="top"></td>
                > > > <td width="196" height="226" valign="top">Rate of
                > > > Exchange:<br>One Dollar=20 Nacfa<br>One Euro=25 Nacfa</td>
                > > > <td width="3" height="226" valign="top"></td>
                > > > </tr>
                > > > <tr>
                > > > <td width="14" height="1" valign="top"><img
                > > src="transparent.gif"
                > > > alt="" width="14" height="1"></td>
                > > > <td width="514" height="1" valign="top"><img
                > > > src="transparent.gif" alt="" width="514" height="1"></td>
                > > > <td width="7" height="1" valign="top"><img
                > src="transparent.gif"
                > > > alt="" width="7" height="1"></td>
                > > > <td width="196" height="1" valign="top"><img
                > > > src="transparent.gif" alt="" width="196" height="1"></td>
                > > > <td width="3" height="1" valign="top"><img
                > src="transparent.gif"
                > > > alt="" width="3" height="1"></td>
                > > > </tr>
                > > > </table>
                > > > </body>
                > > > </html>
                > > >
                > > >
                > >
                >
                > '*******************************************************************
                > >
                >
                > '*******************************************************************
                > *
                > > *
                > > >
                > >
                >
                **********************************************************************
                > > > *
                > > >
                > > > SECOND FILE
                > > >
                > >
                >
                > '*******************************************************************
                > *
                > >
                > > '******************************************************************
                > >
                >
                > '*******************************************************************
                > *
                > > >
                > > > <html>
                > > > <head>
                > > > <script language="javascript" type="text/javascript">
                > > >
                > > > </script>
                > > > <title>Anberbeb Share Company -Buy</title>
                > > >
                > > > </head>
                > > > <body>
                > > > <table border="0" cellpadding="0" cellspacing="0" width="80%"
                > > > align="center">
                > > > <tr>
                > > > <td width="14" height="32" valign="top"></td>
                > > > <td width="720" height="32" colspan="4" valign="top">Home
                > > > Shopcart Currency </td>
                > > > </tr>
                > > > <tr>
                > > > <td width="14" height="29" valign="top"></td>
                > > > <td width="720" height="29" colspan="4" valign="top"><div
                > > > align="left"><span class="style3">Secure Order Form
                > > </span></div></td>
                > > > </tr>
                > > > <tr>
                > > > <td width="14" height="226" valign="top"></td>
                > > > <td width="514" height="226" valign="top"
                > align="center"><form
                > > > name="purchase" action="buy.php" method="POST"><table border="1"
                > > > width="512"><tr><td colspan="2">Delivery Address</td></tr>
                > > > <tr><td valign="top">Address</td><td><textarea
                > readonly="readonly"
                > > > cols="20" rows="4" name="address">pobox
                10786</textarea></td></tr>
                > > > <tr><td>City</td><td><input type="text" name="city"
                > value="Asmara"
                > > > readonly="readonly"></td></tr>
                > > > <Tr><td>Country</td><td><input type="text" name="country"
                > > > value="Eritrea" readonly="readonly"></td></tr>
                > > > <tr><td>Tele</td><td><input type="text" name="tele"
                > value="152151"
                > > > readonly="readonly"></td></tr>
                > > > <tr><td colspan="2" align="right"><a href="#">Edit
                > > > Address</a></td></tr>
                > > > <tr><td colspan="2">Order Information</td></tr>
                > > > <tr><td colspan="2">
                > > > <table border="1" width="500"><tr><td colspan="2">Car Number
                > > > 1</td></tr>
                > > > <tr><td>Car</td><td>Ambulance coaster</td></tr>
                > > > <tr><td>Unit Price</td><td>25000 USD</td></tr>
                > > > <tr><td><input type="hidden" name="U1001AB100001"
                > > > value="25000"><input type="hidden" name="T1001AB100001"
                > > > value="7"></td><td><input type="hidden" name="1001AB100001"
                > > > value="1001AB100001"></td></tr>
                > > > <tr><td>Availiable in Store</td><td>7 Cars</td></tr>
                > > > <tr><td>Order how many</td><td><select name="1001AB100001"
                > > > onClick="setmoney()" onChange="setmoney()"><option value="1">1
                > > > cars</option><option value="2">2 cars</option><option
                value="3">3
                > > > cars</option><option value="4">4 cars</option><option
                value="5">5
                > > > cars</option><option value="6">6 cars</option><option
                value="7">7
                > > > cars</option></select>
                > > > </td></tr>
                > > > <tr><td valign="top">Price</td><td><input type="text"
                > > > readonly="readonly" size="11" name="ttldollar1001AB100001">
                > > > Dollar<br><input type="text" readonly="readonly" size="11"
                > > > name="ttleuro1001AB100001"> Euro<br><input type="text"
                > > > readonly="readonly" size="11" name="ttlnacfa1001AB100001">
                > > > Nacfa</td></tr>
                > > > </table>
                > > > <table border="1" width="500"><tr><td colspan="2">Car Number
                > > > 2</td></tr>
                > > > <tr><td>Car</td><td>Ambulance coaster</td></tr>
                > > > <tr><td>Unit Price</td><td>15000 USD</td></tr>
                > > > <tr><td><input type="hidden" name="U1001AB100002"
                > > > value="15000"><input type="hidden" name="T1001AB100002"
                > > > value="42"></td><td><input type="hidden" name="1001AB100002"
                > > > value="1001AB100002"></td></tr>
                > > > <tr><td>Availiable in Store</td><td>42 Cars</td></tr>
                > > > <tr><td>Order how many</td><td><select name="1001AB100002"
                > > > onClick="setmoney()" onChange="setmoney()"><option value="1">1
                > > > cars</option><option value="2">2 cars</option><option
                value="3">3
                > > > cars</option><option value="4">4 cars</option><option
                value="5">5
                > > > cars</option><option value="6">6 cars</option><option
                value="7">7
                > > > cars</option><option value="8">8 cars</option><option
                value="9">9
                > > > cars</option><option value="10">10 cars</option><option
                > > value="11">11
                > > > cars</option><option value="12">12 cars</option><option
                > > value="13">13
                > > > cars</option><option value="14">14 cars</option><option
                > > value="15">15
                > > > cars</option><option value="16">16 cars</option><option
                > > value="17">17
                > > > cars</option><option value="18">18 cars</option><option
                > > value="19">19
                > > > cars</option><option value="20">20 cars</option><option
                > > value="21">21
                > > > cars</option><option value="22">22 cars</option><option
                > > value="23">23
                > > > cars</option><option value="24">24 cars</option><option
                > > value="25">25
                > > > cars</option><option value="26">26 cars</option><option
                > > value="27">27
                > > > cars</option><option value="28">28 cars</option><option
                > > value="29">29
                > > > cars</option><option value="30">30 cars</option><option
                > > value="31">31
                > > > cars</option><option value="32">32 cars</option><option
                > > value="33">33
                > > > cars</option><option value="34">34 cars</option><option
                > > value="35">35
                > > > cars</option><option value="36">36 cars</option><option
                > > value="37">37
                > > > cars</option><option value="38">38 cars</option><option
                > > value="39">39
                > > > cars</option><option value="40">40 cars</option><option
                > > value="41">41
                > > > cars</option><option value="42">42 cars</option></select>
                > > > </td></tr>
                > > > <tr><td valign="top">Price</td><td><input type="text"
                > > > readonly="readonly" size="11" name="ttldollar1001AB100002">
                > > > Dollar<br><input type="text" readonly="readonly" size="11"
                > > > name="ttleuro1001AB100002"> Euro<br><input type="text"
                > > > readonly="readonly" size="11" name="ttlnacfa1001AB100002">
                > > > Nacfa</td></tr>
                > > > </table>
                > > >
                > > > </td></tr>
                > > > <tr><td colspan="2">Payment Options</td></tr>
                > > > <tr><td>Pay In</td><td><select name="currency" onClick="setmoney
                > ();"
                > > > onChange="setmoney();"><option value="Dollar"
                > > > selected="selected">Dollar</option><option
                > > > value="Euro">Euro</option><option
                > > > value="Nacfa">Nacfa</option></select></td></tr>
                > > > <tr><td valign="top">Total Price</td><td><input type="text"
                > > > readonly="readonly" size="11" name="ttldollar"> Dollar<br><input
                > > > type="text" readonly="readonly" size="11" name="ttleuro">
                > > > Euro<br><input type="text" readonly="readonly" size="11"
                > > > name="ttlnacfa"> Nacfa</td></tr>
                > > > <tr><td colspan="2">Payment Method</td></tr>
                > > > <tr><td><input type="radio" name="paymethods[]"
                > > > value="1">Online</td><td>Credit Card<br><select
                > > > name="creditcar"><option value="Visa">Visa</option><option
                > > > value="Master">Master</option><option
                > > > value="Discover">Discover</option></select><br>Card Holder
                > > > Name<br><input type="text" name="cardholdername"><br>Expiry
                > > > Date<br><input type="text" name="expdate"></td></tr>
                > > > <tr><td><input type="radio" name="paymethods[]"
                > > > value="2">Phone</td><td>Phone</td></tr>
                > > > <tr><td><input type="radio" name="paymethods[]"
                > > > value="3">Fax</td><td>FAX</TD></TR>
                > > > <tr><td colspan="2" align="center"><input type="submit"
                > > value="Order"
                > > > name="submit"></td></tr>
                > > > </table></form>
                > > > </td>
                > > > <td width="7" height="226" valign="top"></td>
                > > > <td width="196" height="226" valign="top">Rate of
                > > > Exchange:<br>One Dollar=20 Nacfa<br>One Euro=25 Nacfa</td>
                > > > <td width="3" height="226" valign="top"></td>
                > > > </tr>
                > > > <tr>
                > > > <td width="14" height="1" valign="top"><img
                > > src="transparent.gif"
                > > > alt="" width="14" height="1"></td>
                > > > <td width="514" height="1" valign="top"><img
                > > > src="transparent.gif" alt="" width="514" height="1"></td>
                > > > <td width="7" height="1" valign="top"><img
                > src="transparent.gif"
                > > > alt="" width="7" height="1"></td>
                > > > <td width="196" height="1" valign="top"><img
                > > > src="transparent.gif" alt="" width="196" height="1"></td>
                > > > <td width="3" height="1" valign="top"><img
                > src="transparent.gif"
                > > > alt="" width="3" height="1"></td>
                > > > </tr>
                > > > </table>
                > > > </body>
                > > > </html>
                > > >
                > > >
                > >
                >
                > '*******************************************************************
                > *
                > > *
                > >
                >
                > '*******************************************************************
                > *
                > > *
                > > >
                > > > I hope they are helpful.
                > > >
                > > > Sami
                > > >
                > > >
                > > >
                > > >
                > > > --- In JavaScript_Official@yahoogroups.com, Tim Sabin <tim@>
                > > wrote:
                > > > >
                > > > > I've got an idea of what you need, but it's hard to say
                without
                > > > looking
                > > > > at the code. Please post your entire page (both HTML and
                > > > JavaScript) and
                > > > > let us have a look.
                > > > >
                > > > > --Tim Sabin
                > > > >
                > > > >
                > > > > saminor2002 wrote:
                > > > > > Hi guys,
                > > > > > I am new to this club and hope to find your help as soon as
                > > > possible.
                > > > > > I have an order form, where customers can buy single items
                or
                > > > multiple
                > > > > > items. It works like this: the company sets the prices in
                > > dollar,
                > > > but
                > > > > > users also know the equalivalent in euro. If a customer
                > orders 4
                > > > items
                > > > > > that worth 4dollars, the total is told in both dollar and
                > euro.
                > > > But
                > > > > > when the customer wants to order in bulk, i was not able to
                > do
                > > > the
                > > > > > conversion because the number of textboxes is built
                > dynamically.
                > > > I
                > > > > > need to tell the customer the ttl amount per group of items
                > > (e.g.
                > > > CD
                > > > > > roms and dvd roms) and then the total amount of all the
                > items.
                > > > Sorry
                > > > > > my english is not good. Need further explanation, let me
                know.
                > > > > >
                > > > > > Sami
                > > > > >
                > > > > >
                > > > > >
                > > > > > Visit http://aiaiai.com for more groups to join
                > > > > > Yahoo! Groups Links
                > > > > >
                > > > > >
                > > > > >
                > > > > >
                > > > > >
                > > > > >
                > > > >
                > > >
                > > >
                > > >
                > > >
                > > > Visit http://aiaiai.com for more groups to join
                > > > Yahoo! Groups Links
                > > >
                > > >
                > > >
                > > >
                > > >
                > >
                > > --Tim Sabin
                > >
                >
                >
                >
                >
                > Visit http://aiaiai.com for more groups to join
                > Yahoo! Groups Links
                >
                >
                >
                >
                >

                --Tim Sabin
              Your message has been successfully submitted and would be delivered to recipients shortly.