ok here is the problem, i have to forms which have values i wish to be added together i can add together the values in one form all right but im having problems with adding the values of the other form to it... ill post the code for you to look at and try to explaine in detail what im trying to do.
here is the code (HTML and Javascript so you get the whole picture):
Javascript:
and the html (form 1):
(form 2):
Now what i need is to be able to get the values of 'frmExtras' into the box 'txtTotalprice' if the check box for chkGen is selected or an ammount from 'txtLammount' if it has a value in it.. ive been trying to nut it out and my own knowledge is just too limited i need help with it... any advice of how to go about it would be great.
DD
here is the code (HTML and Javascript so you get the whole picture):
Javascript:
Code:
var gen, lights;
var lammount;
function validatetheform()
{
if (!document.frmTorder.txtBname.value)
{
alert("Please enter your buisness name.");
document.frmTorder.txtBname.focus();
}
else if(!document.frmTorder.txtBaddy.value)
{
alert("Please enter you Buisness address.");
document.frmTorder.txtBaddy.focus();
}
else if(!document.frmTorder.txtPcode.value)
{
alert("Plese enter your postcode");
document.frmTorder.txtPcode.focus();
}
else if(!document.frmTorder.txtState.value)
{
alert("Please enter you state.");
document.frmTorder.txtState.focus();
}
else if(!document.frmTorder.txtSite.value)
{
alert("Please enter the event address.");
document.frmTorder.txtSite.focus();
}
return true;
}
function total_add()
{
var bubbleday, simday, slideday, bungiesday;
var bubble, sim, slide, bungies;
var bubblet, simt, slidet, bungiest;
var total;
// Setting the value for the days
bubbleday = document.frmTorder.txtBubbledays.value;
simday = document.frmTorder.txtSimdays.value;
slideday = document.frmTorder.txtSlidedays.value;
bungiesday = document.frmTorder.txtBungiedays.value;
// setting the value for the set price
bubble = document.frmTorder.txtBubbleprice.value;
sim = document.frmTorder.txtSimprice.value;
slide = document.frmTorder.txtSlideprice.value;
bungies = document.frmTorder.txtBungieprice.value;
// calculating the total of the individual rides
bungiest = bungies * bungiesday;
simt = sim * simday;
slidet = slide * slideday;
bubblet = bubble * bubbleday;
// setting the value total with the ammounts from the rides
total = bubblet + slidet + simt + bungiest;
document.frmTorder.txtTotalprice.value = total;
}
function extras()
{
if (document.frmExtras.chkGen = selected)
{
gen = document.frmExtras.txtGenprice.value;
}
alert("Gen amount is: " + gen);
}
Code:
<form name="frmTorder" method="post" onSubmit="validatetheform()" onReset="document.frmTorder.txtBname.focus()"> <font color="lightgreen"><strong>*</strong></font>Buisness Name: <input type="text" name="txtBname" size="20"><br /> <font color="lightgreen"><strong>*</strong></font>Address: <input type="text" name="txtBaddy" size="50"><br /> <font color="lightgreen"><strong>*</strong></font>Post Code: <input type="text" name="txtPcode" size="4"> <font color="lightgreen"><strong>*</strong></font>State: <input type="text" name="txtState" size="4"><br /> <br /><hr /><br /> <font color="lightgreen"><strong>*</strong></font>Address of event: <input type="text" name="txtSite" size="50"><br /> <font color="lightgreen"><strong>*</strong></font>Start date: <input type="text" name="txtSdate" class="calendarSelectDate" size="10"/> <font color="lightgreen"><strong>*</strong></font>End date of event: <input type="text" name="txtEdate" size="10" class="calendarSelectDate"><br /> Street Referance: <input type="text" name="txtSref" size="50"><br /> <br /><hr /><br /> <center><table name="tblRides" border="0"> <tr> <td>Rides</td> <td><font color="lightgreen"><strong>*</strong></font>Required Days</td> <td><center>Price</center></td> </tr> <tr> <td>Trampoline Bungies</td> <td><center><input type="text" name="txtBungiedays" size="2" onchange="total_add()"></center></td> <td class="price"><center><input type="text" name="txtBungieprice" size="7" value="2000.00" disabled></center></td> </tr> <tr> <td>Tarzan Jumping Castel</td> <td><center><input type="text" name="txtBubbledays" size="2" onChange="total_add()"></center></td> <td class="price"><center><input type="text" name="txtBubbleprice" size="7" value="1200.00" disabled></center></td> </tr> <tr> <td>Voyager Simulator</td> <td><center><input type="text" name="txtSimdays" size="2" onChange="total_add()"></center></td> <td class="price"><center><input type="text" name="txtSimprice" size="7" value="1850.00" disabled></center></td> </tr> <tr> <td>Giant Slide</td> <td><center><input type="text" name="txtSlidedays" size="2" onChange="total_add()"></center></td> <td class="price"><center><input type="text" name="txtSlideprice" size="7" value="1850.00" disabled></center></td> </tr> <tr> <td>Food Van</td> <td><center><input type="text" name="txtFvandays" size="2" onChange="total_add()"></center></td> <td class="price"><center><input type="text" name="txtFvanprice" size="7" value="0.00" disabled></center></td> </tr> <tr> <td></td> <td>Total Amount Owing: $</td> <td class="price"><input type="text" name="txtTotalprice" size="7" disabled></td> </tr> </table></center><br /> <center>Extra Details/Questions: <br /><textarea name="txtComments" rows="8" cols="40">Place any extra details or questions here.</textarea></center><br /><br /> <center><input type="submit" name="btnSubmit" value="Make Booking"> <input type="reset" name="btnReset" value="Reset the order"></center> </form>
Code:
<form name="frmExtras" method="post"> <li><input type="checkbox" name="chkGen"> Generator (Simulator Only).<input type="hidden" name=txtGenprice" value="1000" onchange="extras()"></li> <li><input type="checkbox" name="chkLights"> Lights. <br /><input type="text" name="txtLammount" value="0" size="2" onchange=""> Ammount needed.<input type="hidden" name=txtLprice" value="1000"></li> </form>
DD
Comment