First Post, please help me with this script
<!DOCTYPE>
<html><head>
<title>Chapter Two</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script type="text/javascript">
/*<CDATA[[*/
var guestsCost=0;
var limousinesCost=0;
var liveMusicCost=0;
var flowersCost=0;
var totalEstimate=0;
function calcGuests(){
totalEstimate -= guestsCost;
guestsCost = document.details.numGuests.value * 65;
totalEstimate += guestsCost;
document.estimate.cost.value = "$" + totalEstimate;
}
/*]]>*/
</script>
</head>
<body>
<form action="" name="details">
<table border="1">
<tr>
<td>Guests<br />
($65 each)</td>
<td>
<input type="text" name="numGuests" size="5" onchange="calcGuests();" /></td>
</tr>
</table>
</form>
<form action="" name="estimate">
<p>
<input type="text" name="cost" size="5"
style="border-style: none; border-color: inherit border-width: medium; background-color: yellow; text="0" /></p>
</form>
</body>
</html>
I didn't understand what the second statement (totalEstimate -= guestsCost in the "calcGuests" function is for?
Please someone explain to me as I'm a beginner.
Thanks in Advance!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks