Best Download Sites Login
Site Login

More JavaScript Forms

Accept Terms | Agree Before Entry | All Lower Case | All Upper Case | Auto Currency | Auto Drop Down | Auto Month | Auto Tab | Auto Year List | Basic Validation | Block Key Press | Check Form | Check For Spaces | Checkbox Counter | Checkbox Text | Checkbox Changer | Add Commas | Copy Form Fields | Copy Name Field | Country Select List | Currency Format | Select A Day | Decimals Allowed | Disable Submit | Email Domain WHOIS | Basic Email Validation | Email Validation | Expanding Textbox | Extended Characters | Extract Email | Field Explanation | File Open | Form Focus | Form Swapper | Form Order Totals | Form Target Formatting | Format Input Case | Format Date | Preview HTML | Ignore Spaces | First Letter Uppercase | Items Popup List | Remember Items | Limit Textarea | Limit checkboxes | Textarea Line Wrap | List Chooser | List Organizer | Locked Textbox | Mail Pick Subject | Mailing List | Max Text Entry | Memory Cells | Money Filter | Multiple Mailer List | No Duplicates Entries | No Blank Entry | No HTML Entries | Only One Field | Customized Popup | Option Search | Pass Menu Frames | Pass Textbox Frames | Password Verification | Quantity Totals | Radio Totals | Convert Returns | Replace Characters | Required Fields | Search Box | Copy Selection Box | Selection Order | Select One | Select All | Sentence Caps | Smart Pulldown Menu | Dirty Words Filter | All Spaces To Plus | Strip Characters | Submit With Text Link | Submit Once | Submit Changer | Tab Key Emulation | Text Cycle | Text Reverse | Form Time Limit | Trim Leading Spaces | Trim Trailing Spaces | True Date Selected | Site Upload Filter | Removes Characters | Properly Filled | Valid Credit Card | Date Validated | External JS | Validate Guestbook | Verify IP address | Password Verify | Invalid submissions | Social Security Number | Verifies Valid Time | Invalid Zip Code | Validate Dates | Receive Feedback | Textarea Word Count | Word Character Count | Zip To State

Radio Totals

Description
(Best with Internet Explorer) Select items in this totals form using checkboxes and radio buttons it will find the total and updates automatically....View A Script Demo


Do you find it confusing setting up these script?
Java Scripts Magic can do all the hard work for you all At The Touch Of A Button.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="Generator" CONTENT="TextPad 4.4">
<LINK href="general.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE="JavaScript">
<!-- Original:  Paul DeBrino (irandd@aol.com) -->
<!-- Web Site:  http://members.aol.com/irandd/ -->

<!-- Begin
//Define function to manipulate the form total per item selected/deselected:
function CheckChoice(whichbox) {
with (whichbox.form) {
//Handle differently, depending on type of input box.
if (whichbox.type == "radio") {
//First, back out the prior radio selection's price from the total:
hiddentotal.value = eval(hiddentotal.value) - eval(hiddenpriorradio.value);
//Then, save the current radio selection's price:
hiddenpriorradio.value = eval(whichbox.price);
//Now, apply the current radio selection's price to the total:
hiddentotal.value = eval(hiddentotal.value) + eval(whichbox.price);
}
else {
//If box was checked, accumulate the checkbox value as the form total,
//Otherwise, reduce the form total by the checkbox value:
if (whichbox.checked == false) {
hiddentotal.value = eval(hiddentotal.value) - eval(whichbox.value);
}
else {
hiddentotal.value = eval(hiddentotal.value) + eval(whichbox.value);
   }
}
//Ensure the total never goes negative (some browsers allow radiobutton to be deselected):
if (hiddentotal.value < 0) {
InitForm();
}
//Now, return with formatted total:
return(formatCurrency(hiddentotal.value));
   }
}
//Define function to format a value as currency:
function formatCurrency(num) {
<!-- Function courtesy of:  Cyanide_7 (leo7278@hotmail.com) -->
<!-- Web Site:  http://www7.ewebcity.com/cyanide7 -->
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num)) num = "0";
cents = Math.floor((num*100+0.5)%100);
num = Math.floor((num*100+0.5)/100).toString();
if(cents < 10) cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
return ("$" + num + "." + cents);
}
//Define function to init the form on reload:
function InitForm() {
//Reset the displayed total on form:
document.myform.total.value='$0';
document.myform.hiddentotal.value=0;
document.myform.hiddenpriorradio.value=0;
document.myform2.total.value='$0';
document.myform2.hiddentotal.value=0;
document.myform2.hiddenpriorradio.value=0;
document.myform2.hiddenpriorradio.value=0;
//Set all checkboxes and radio buttons on form-1 to unchecked:
for (xx=0; xx < document.myform.elements.length; xx++) {
if (document.myform.elements[xx].type == 'checkbox' | document.myform.elements[xx].type == 'radio') {
document.myform.elements[xx].checked = false;
   }
}
//Set all checkboxes and radio buttons on form-2 to unchecked:
for (xx=0; xx < document.myform2.elements.length; xx++) {
if (document.myform2.elements[xx].type == 'checkbox' | document.myform2.elements[xx].type == 'radio') {
document.myform2.elements[xx].checked = false;
      }
   }
}
//  End -->
</script>


</HEAD>

<BODY Background=../graphics/grayback.jpg onLoad="InitForm();" onreset="InitForm();">
<center><BR><BR><BR>
<form method=POST name=myform>
Steak $15.25
<input type=checkbox name=Steak value=15.25 onClick="this.form.total.value=CheckChoice(this);">
Chicken $12.39
<input type=checkbox name=Chicken value=12.39 onClick="this.form.total.value=CheckChoice(this);">
Sushi $18.75
<input type=checkbox name=Sushi value=18.75 onClick="this.form.total.value=CheckChoice(this);">
<br>
<br>
<b>Prepare with this special sauce (extra charge -- only one selection allowed):</b>
<br>
None, thanks
<input type=radio name=Sauce value=none price=0.00 onClick="this.form.total.value=CheckChoice(this);">
Duck Sauce $10.99
<input type=radio name=Sauce value=duck price=10.99 onClick="this.form.total.value=CheckChoice(this);">
Ginger Sauce $5.00
<input type=radio name=Sauce value=ginger price=5.00 onClick="this.form.total.value=CheckChoice(this);">
Hot Sauce $1.50
<input type=radio name=Sauce value=hot price=1.50 onClick="this.form.total.value=CheckChoice(this);">
<br>
<br>
<br>
<input type=hidden name=hiddentotal value=0>
<input type=hidden name=hiddenpriorradio value=0>
Your total is: <input type=text name=total readonly>
<br>
<br>
(Note: Total can not be changed by the visitor.)
</font>
</form>
<hr width=100% noshade>
<form method=POST name=myform2>
Roasted Pig $10.00
<input type=checkbox name=Pig value=10.00 onClick="this.form.total.value=CheckChoice(this);">
Roasted Rat $17.49
<input type=checkbox name=Rat value=17.49 onClick="this.form.total.value=CheckChoice(this);">
Roasted Cat $3.50
<input type=checkbox name=Cat value=3.50  onClick="this.form.total.value=CheckChoice(this);">
<br>
<br>
<b>Prepare with this special seasoning (extra charge -- only one selection allowed):</b>
<br>
None, thanks
<input type=radio name=Season value=none price=0.00 onClick="this.form.total.value=CheckChoice(this);">
Liquid Nitrogen $17.50
<input type=radio name=Season value=nitrogen price=17.50 onClick="this.form.total.value=CheckChoice(this);">
Gun Powder $8.50
<input type=radio name=Season value=gunpowder price=8.50 onClick="this.form.total.value=CheckChoice(this);">
Vodka $4.00
<input type=radio name=Season value=vodka price=4.00 onClick="this.form.total.value=CheckChoice(this);">
<br>
<br>
<br>
<input type=hidden name=hiddentotal value=0>
<input type=hidden name=hiddenpriorradio value=0>
Your total is: <input type=text name=total readonly>
<br>
<br>
(Note: Total can not be changed by the visitor.)
</font>
</form>

</center>
</BODY>
</HTML>
 

Business Proposal If you have a Business Proposal that you think may be of interest to us here at Best Download Sites please contact us to discuss the matter in further detail