<script LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com
num = num.toString().replace(/\|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
num = Math.floor(num/100).toString();
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 (((sign)?'':'-') + '' + num);
}
//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>
<input type="radio" name="question1" value=none price=2
onclick="this.form.total.value=CheckChoice(this);">
a) In the morning.<br><br>
<input type="radio" name="question1" value=duck price=4
onclick="this.form.total.value=CheckChoice(this);">
<input type="radio" name="question1" value=ginger price=6
onclick="this.form.total.value=CheckChoice(this);">
c) Late at night.<br><br><br>
<b>2. You usually walk...</b><br><br>
<input type="radio" name="question2" value=ginger price=6
onclick="this.form.total.value=CheckChoice(this);">
a) Fairly fast, with long steps.<br><br>
<input type="radio" name="question2" value=ginger price=4
onclick="this.form.total.value=CheckChoice(this);">
<input type="radio" name="question2" value=ginger price=7
onclick="this.form.total.value=CheckChoice(this);">
c) Less fast head up, looking the world in the face.<br><br>
<input type="radio" name="question2" value=ginger price=2
onclick="this.form.total.value=CheckChoice(this);">
d) Less fast, head down.<br><br>
<input type="radio" name="question2" value=ginger price=1
onclick="this.form.total.value=CheckChoice(this);">
e) Very slowly.<br><br><br>
<input type="hidden" name="hiddentotal" value=0>
<input type="hidden" name="hiddenpriorradio" value=0>
<font size=+1>
Your Score: <input type="text" name="total" readonly onFocus="this.blur();">
</font>
<br><br>
</font>
</form>
Now what I am trying to do is to make it so when I click on the radio buttons they add a set number to the total (which is also subtracted from the total when another button in the group is clicked). I'm not really sure where to go from here... Any help would be much appreciated. You can contact me on YIM or G-talk my sn for both is corban324
Thanks,
Corban
p.s. if you didn't notice I've edited the origional script to fit my needs quite a bit.