...

View Full Version : help to add quantity and price



johnkennykumar
03-20-2009, 03:19 PM
Well i wrote this script and its doing fine.There are three quantity text boxes and as i select the quantity the price corresponding to the quantity gets added up.the help i need here is that i need to print the quantity of the three keys at the bottom ex:2 basic 3 pro 5 cor and the total price of all the three keys.Struggling a litle here any help, and i would be very thankful
Thank you

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>AP3 - Encryption Redefined</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="ap3.css" type="text/css" rel="stylesheet" />
<link href="menu.css" type="text/css" rel="stylesheet" />
<link href="btn.css" type="text/css" rel="stylesheet" />




<script type="text/javascript">
function calculateTotal(frm){
var total = 0;
if (frm.tablesponsor[0].checked) {total = 100}
if (frm.tablesponsor[1].checked) {total = 200}
if (frm.tablesponsor[2].checked) {total = 300}
if (frm.tablesponsor[3].checked) {total = 400}
document.getElementById('divId1').innerHTML = "$" + total;
total = total * (frm.individualtickets.value);
total = total.toFixed(2);
document.getElementById('divId').innerHTML = "$" + total;
}
function calculateTotal1(frm){
var total = 0;
if (frm.tablesponsor1[0].checked) {total = 100}
if (frm.tablesponsor1[1].checked) {total = 200}
if (frm.tablesponsor1[2].checked) {total = 300}
if (frm.tablesponsor1[3].checked) {total = 400}
document.getElementById('divId2').innerHTML = "$" + total;
total = total * (frm.individualtickets1.value);
total = total.toFixed(2);
document.getElementById('divId3').innerHTML = "$" + total;
}
function calculateTotal2(frm){
var total = 0;
if (frm.tablesponsor2[0].checked) {total = 100}
if (frm.tablesponsor2[1].checked) {total = 200}
if (frm.tablesponsor2[2].checked) {total = 300}
if (frm.tablesponsor2[3].checked) {total = 400}
document.getElementById('divId4').innerHTML = "$" + total;
total = total * (frm.individualtickets2.value);
total = total.toFixed(2);
document.getElementById('divId5').innerHTML = "$" + total;
}

</script>




</head>
<body>
<div id="main">
<form id="form1" name="form1" method="get" action="">
<div id="top">
<div class="ts-1">

</div>
</div>
<div id="menu">

</div>


<div id="content">
<div id="bigboxgrad">


</div>
<div id="bigboxcont">
<div class="ts-5">

<div class="ts-5-4">
<div class="buynowtop">
<img height="68" alt="" src="img/buynow_toppic.jpg" width="676" />


</div>
</div>
<div class="ts-5-5">&nbsp;</div>
<div class="ts-5-6">
<div class="ts-6">

</div>
</div>

</div>
<img height="10" alt="" src="img/s.gif" width="1" />
<div><img alt="" src="img/medbox_greytop.gif" /></div>
<div id="prodgrey">
<div><img height="4" alt="" src="img/medbox_whitetop.gif" width="908" /></div>
<div id="prodwhite">
<div class="ts-7">
<div class="ts-7-1"><img height="103" alt="" src="img/logo_basickey.gif" width="146" /></div>
<div class="ts-7-2"><img height="172" alt="Basic Key" src="img/prod_big_basic.jpg" width="145" /><br /></div>
<div class="ts-7-3">


<div id="btn_moreinfo">

</div>
<p></p>
</div>
<div class="ts-7-4">

<div class="ts-8">
<div class="ts-8-1"><img height="18" alt="" src="img/buynow_gb.gif" width="146" /></div>
<div class="ts-8-2">
<div class="ts-9">
<div class="ts-9-1">
<div align="center"><input id="tablesponsor" type="radio" checked="-1" name="radio" value="" onClick="calculateTotal(this.form)"/> </div>
</div>
<div class="ts-9-2">
<div align="center"><input id="tablesponsor" type="radio" name="radio" value="" onClick="calculateTotal(this.form)"/> </div>
</div>
<div class="ts-9-3">
<div align="center"><input id="tablesponsor" type="radio" name="radio" value="" onClick="calculateTotal(this.form)"/> </div>
</div>
<div class="ts-9-4">
<div align="center"><input id="tablesponsor" type="radio" name="radio" value="" onClick="calculateTotal(this.form)"/> </div>
</div>
</div>
</div>
<div class="prodbuy- ts-8-3" id= "divId1"><strong>$0</strong></div>
<div class="ts-8-4"><img height="20" alt="Quantity" src="img/topic_small_quantity.gif" width="57" /></div>
<div class="ts-8-5">
<div class="ts-10">
<div class="ts-10-1">
<div align="left">
<select id="individualtickets" name="select" class="input2" onclick="calculateTotal(this.form)">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="300">300</option>
<option value="400">400</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
</div>
</div>
<div class="ts-10-2">
<div align="right" style="margin-top: 4px;" id= "divId"><strong>$0</strong></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div><img height="8" alt="" src="img/buynow_break.gif" width="908" /></div>
<div id="prodwhite">
<div class="ts-7">

<div class="ts-7-3">


<div id="btn_moreinfo">

</div>
<p></p>
</div>
<div class="ts-7-4">
<p><img height="17" alt="Choose Capacity" src="img/topic_small_cc.gif" width="98" /><br /><br /></p>
<div class="ts-8">
<div class="ts-8-1"><img height="18" alt="" src="img/buynow_gb.gif" width="146" /></div>
<div class="ts-8-2">
<div class="ts-9">
<div class="ts-9-1">
<div align="center">
<input id="tablesponsor1" type="radio" checked="checked" name="radio" value="" onclick="calculateTotal1(this.form)"/>
</div>
</div>
<div class="ts-9-2">
<div align="center">
<input id="tablesponsor1" type="radio" checked="checked" name="radio" value="" onclick="calculateTotal1(this.form)"/>
</div>
</div>
<div class="ts-9-3">
<div align="center">
<input id="tablesponsor1" type="radio" checked="checked" name="radio" value="" onclick="calculateTotal1(this.form)"/>
</div>
</div>
<div class="ts-9-4">
<div align="center">
<input id="tablesponsor1" type="radio" checked="checked" name="radio" value="" onclick="calculateTotal1(this.form)"/>
</div>
</div>
</div>
</div>
<div class="prodbuy- ts-8-3" id="divId2"><strong>$0</strong></div>
<div class="ts-8-4"><img height="20" alt="Quantity" src="img/topic_small_quantity.gif" width="57" /></div>
<div class="ts-8-5">
<div class="ts-10">
<div class="ts-10-1">
<div align="left">
<select id="individualtickets1" name="select" class="input2" onclick="calculateTotal1(this.form)">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="300">300</option>
<option value="400">400</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
</div>
</div>
<div class="ts-10-2">
<div align="right" style="margin-top: 4px;" id="divId3"><strong>$0</strong></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div><img height="8" alt="" src="img/buynow_break.gif" width="908" /></div>
<div id="prodwhite">
<div class="ts-7">

<div class="ts-7-3">


<div id="btn_moreinfo">

</div>
<p></p>
</div>
<div class="ts-7-4">
<p><img height="17" alt="Choose Capacity" src="img/topic_small_cc.gif" width="98" /><br /><br /></p>
<div class="ts-8">
<div class="ts-8-1"><img height="18" alt="" src="img/buynow_gb.gif" width="146" /></div>
<div class="ts-8-2">
<div class="ts-9">
<div class="ts-9-1">
<div align="center">
<input id="tablesponsor2" type="radio" checked="check" name="radio" value="" onclick="calculateTotal2(this.form)"/>
</div>
</div>
<div class="ts-9-2">
<div align="center">
<input id="tablesponsor2" type="radio" checked="check" name="radio" value="" onclick="calculateTotal2(this.form)"/>
</div>
</div>
<div class="ts-9-3">
<div align="center">
<input id="tablesponsor2" type="radio" checked="check" name="radio" value="" onclick="calculateTotal2(this.form)"/>
</div>
</div>
<div class="ts-9-4">
<div align="center">
<input id="tablesponsor2" type="radio" checked="check" name="radio" value="" onclick="calculateTotal2(this.form)"/>
</div>
</div>
</div>
</div>
<div class="prodbuy- ts-8-3" id="divId4"><strong>$0</strong></div>
<div class="ts-8-4"><img height="20" alt="Quantity" src="img/topic_small_quantity.gif" width="57" /></div>
<div class="ts-8-5">
<div class="ts-10">
<div class="ts-10-1">
<div align="left">
<select id="individualtickets2" name="select" class="input2" onclick="calculateTotal2(this.form)">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="200">200</option>
<option value="300">300</option>
<option value="400">400</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
</div>
</div>
<div class="ts-10-2">
<div align="right" style="margin-top: 4px;" id="divId5"><strong>$0</strong></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<img height="4" alt="" src="img/medbox_whitebottom.gif" width="908" />
<br />
<br />
<div class="ts-17">
<div class="ts-17-1">
<div align="right" style="margin-top: 19px;">0 Basic , 0 Pro <strong>Total :$0</strong></div>
</div>
<div class="ts-17-2">

</div>
</div>
</div>
</div>
<div><img src="img/medbox_greybottom.gif" /></div>
</div>
<div id="bigboxbottom"></div>
</div>



</form>
</div>
</body>

abduraooft
03-20-2009, 03:37 PM
Please follow http://www.codingforums.com/showpost.php?p=795833&postcount=5 and http://www.codingforums.com/postguide.htm



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum