Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I want to build an calculator calculates Apt rates

    I want to build an calculator calculates Apt rates (3 adult apt: 2adults=euro41 _ additional adult=euro6 (1 adult same as two) AND air/condition euro6/apt/day), below code is correct ?
    Form At: http://www.holidayaptsaspasia.com/bookingapt.html

    head:
    Code:
    <script type="text/javascript">
    function calc() {
     if (document.book.ac.checked == true) {
        ac = 6;
     } else {
        ac = 0; 	
     }
     document.book.euro.value = document.book.days.value * (floor((document.book.adults.value)/3) * (47+ac) + 41 + ac) ;
    }
    </script>
    body:
    Code:
              <tr>
                <th width="164" height="35" align="right" valign="middle" scope="col"><div align="right">No.
                  of Apts Interested:</div></th>
                <th width="361" align="center" valign="middle" scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="3" summary="javascript calculator euros total">
                  <tr>
                    <td width="12%" align="left" valign="middle"><input name="aptno" type="text" id="aptno" value="1" size="1" maxlength="1" onchange="calc();" /></td>
                    <td width="35%" align="right" valign="middle">No. of Days to Stay:</td>
                    <td width="15%" align="left" valign="middle"><input name="days" type="text" id="days" value="0" size="2" maxlength="2" onchange="calc();" /></td>
                    <td width="15%" align="right" valign="middle" bgcolor="#CCCCCC" class="text_normal"><strong>Total(€):</strong></td>
                    <td width="23%" align="left" valign="middle" bgcolor="#CCCCCC"><input name="euro" type="text" disabled="disabled" class="text_normal_bold_red" id="euro" value="0" size="6" maxlength="6" /></td>
                  </tr>
                </table></th>
              </tr>
              <tr>
                <th height="25" align="center" valign="middle" scope="col">(3 adults
                  per Apt)</th>
                <th align="center" valign="middle" scope="col"><table width="100%" border="0" cellspacing="0" cellpadding="3" summary="javascript calculator euros total">
                  <tr>
                    <td width="25%" align="right" valign="middle">No. of Adults:</td>
                    <td width="16%" align="left" valign="middle"><input name="adults" type="text" id="adults" value="2" size="2" maxlength="2" onblur="calc();" /></td>
                    <td width="27%" align="right" valign="middle">Air Contition:</td>
                    <td width="32%" align="left" valign="middle"><input name="ac" type="checkbox" class="text_normal" id="ac" onblur="calc();" checked="checked" /></td>
                  </tr>
                </table></th>
              </tr>

  • #2
    Regular Coder
    Join Date
    Dec 2005
    Posts
    702
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I must use onblur or onchange to the js calc ?

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,245
    Thanks
    203
    Thanked 2,555 Times in 2,533 Posts
    562 posts, 0 thanks.

    This guy is a web developer and is being paid for his work output.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •