/    Sign up×
Community /Pin to ProfileBookmark

help with quiz code please

If i get rid of the value drop down boxes and replace them with radiogroup1 boxes (numberes 0-5 values 1-5) renaming them first , when i click results nothing happens.

please use the code above it works save it as any html file you want.
so if i remove this (drop down)
<SELECT NAME=”first”>
<OPTION VALUE=1>Yes
<OPTION VALUE=0>No
</SELECT>

and replace it with

<label>
<input type=”radio” name=”RadioGroup1″ value=”1″>
yes</label>
<br>
<label>
<input type=”radio” name=”RadioGroup1″ value=”0″>
no</label>

when i hit get results …..nothing….

maybe something to do with

function AddItUp(form) {
var item, firstValue, secondValue, thirdValue, fourthValue, fifthValue, sixthValue, seventhValue, eighthValue,
ninthValue

// Get the value of the item that’s selected in the first list
item = form.first.selectedIndex;
firstValue = eval(form.first.options[item].value)

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JOct 11.2006 — Here's a quick example

[code=php]<HTML>
<HEAD>
<TITLE>Document Title</TITLE>

<SCRIPT type="text/javascript">
<!--
function AddItUp(form) {
currentTotal=0
for(var i=0;i<form.length;i++){

if(form.elements[i].type=="radio"&&form.elements[i].checked){
currentTotal+=Number(form.elements[i].value)
}

}

form.total.value =currentTotal
}
//-->
</SCRIPT>

</HEAD>
<BODY>


<FORM>

<b>1. Can you stick to deadlines (no matter what)?</b><br><br>
<input type="radio" name="r0" value=1>Yes
<input type="radio" name="r0" value=0>No
<P>Yes - <i>1 point</i> -The court will expect nothing less.<b><br>
No</b> - <i>0 points</i> - You will need to be careful.<br>

<p><b>2. Are you looking to “get even”?</b></p>
<input type="radio" name="r1" value=0>Yes
<input type="radio" name="r1" value=1>No
<P><b>Yes</b> - <i>0 points </i>- Div<br>
<b>No</b> - <i>1 Point</i><br>

<p><b>3. Can you find the time to get to the courthouse during the day?</b></a></p>
<input type="radio" name="r2" value=1>Yes
<input type="radio" name="r2" value=0>No
<P><b>Yes</b> - <i>1 point</i>- A<b><br>
No</b> - <i>0 points</i> - Y<br>

<p><b>4. Do you find yourself yelling at your spouse whenever the topic of money, the kids, or joint decisions come up?</b></p>
<input type="radio" name="r3" value=0>Yes
<input type="radio" name="r3"value=1>No
<p><b>Yes</b> – <i>0 points</i> - <b><br>
No</b> - <i>1 point</i> - A.<br>

<p><b>5. Is your spouse experienced at hiding income or assets?</b></p>
<input type="radio" name="r4" value=0>Yes
<input type="radio" name="r4"value=1>No
<P><b>Yes</b> - <i>0 points</i>.<br>
<b>No</b> - <i>1 point</i><br>

<p><b>6. Was there physical or emotional abuse in your marriage?</b></p>
<input type="radio" name="r5" value=0>Yes
<input type="radio" name="r5" value=1>No
<P><b>Yes</b> - <i>0 points</i> - <br>
<b>No</b> - <i>1 point</i><br>

<p><b>7. Does the following describe you?</b></a></p>
<input type="radio" name="r6" value=1>Yes *
<input type="radio" name="r6" value=0>No
<P><b>No</b> - <i>0 points</i> - <b><br>
Yes</b> - <i>1point</i> - <br>

<p><b>8. Can you make decisions and stick with them?</b></p>
<input type="radio" name="r7" value=1>Yes
<input type="radio" name="r7" value=0>No
<P><b>Yes</b> - <i>1 point</i><b><br>
No</b> - <i>0 points</i> -<br>

<p><b>9. Can you live with some mistakes?</b></a></p>
<input type="radio" name="r9" value=1>Yes *
<input type="radio" name="r9" value=0>No
<p><b>Yes</b> - <i>1point</i> - <br>
<b>No</b> - <i>0 points</i> - <br>

<hr>

<div><b>Results</b></div>

<input type="button" name="cmdCalc" value="Your Results!" onClick="AddItUp(this.form)" style="font-weight: bold; border-style: solid; border-color: #00009B">&nbsp;&nbsp;<b>
<input type="text" name="total" size="7">

<P>1-2 points blah
<p><b>7 points or more:</b> You are a good candidate for handling your own divorce!</p>
<P><b>5-6 points:</b>&nbsp; Thismay be a strain for you.&nbsp;<br>
<P><b>4 points or fewer:</b> Strongly consider hiring an attorney.&nbsp;

</FORM>

</BODY>
</HTML>[/code]
×

Success!

Help @wilburforce spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...