Hello, I am working voluntarily on a application form for a school in Iraq. The condition of filling this form is checking whether the applicant is eligible for scholarship program. This is based on couple conditional question which lead to final calculated score. I would like to do this JavaScript. Is there any chance that someone can put me in the right direction to do this please?
Here are the questions
This tool will allow you to calculate your scores for Scholarship
Where you at top of your school when you graduated: Yes [ ] No [ ]
What is your total Bsc score (ex, 65): [ ] {if yes and under 65 they get 25 score, if no and 65 they they get 25, but plus one score for any whole number over 65, a 66 gets 26, 67 gets 27 ..}
What are you applying for: MSc [ ] PhD [ ]
How many years of working experience do you have: [ ], if zero, please add 0
Is the study related to your working experience: Yes [ ] No [ ]
What type of offer do you have: Conditional [ ] Unconditional [ ]
What is your age: [ ], please round up/down to closest whole age, 25, 26, 27 …(between min 25- max 40)
A
{IF Msc and aged between min 25 (give 15 score) and max 35 (give 0 score), with 1 (1 year givae 2 score) to 5 (5 years give 10 score max) years experiences, related working experience gives 5 score, contional 5 score and uncondition 10 score}
What is your testing language [ ] and your score [ ]
Your total score for HCDP program is [ ]
<i>
</i><html>
<head>
<title> Iraq Scholarship Application </title>
<script type="text/javascript">
// From: http://www.webdeveloper.com/forum/showthread.php?t=239477
// ONLY PARTIALLY COMPLETE AT THIS TIME! SEE LOGIC COMMENT BELOW.
function ComputeScore() {
var tmp = 0;
BScScore = Number(document.getElementById('BScScore').value);
var sum = 0;
// get Age
var Age = Number(document.getElementById('Age').value);
if ((Age < 25) || (Age > 40)) { alert('Not eligible due to age requirements'); return; }
/*
if "topOfClass" = yes and under "BSc" = 65 they get 25 score,
if no and 65 they they get 25, but plus one score for any whole number over 65, a 66 gets 26, 67 gets 27 ...
*/
if (getRBtnName('topOfClass') == "Y") {
sum += 25;
} else {
sum += 25;
if (BScScore > 65) { sum += BScScore - 65; }
}
// add years of experience
var Exp = Number(document.getElementById('Experience').value);
sum += Exp;
/*
Following LOGIC is confusing to me ... Clarification is needed ... ???
IF Msc and aged between min 25 (give 15 score) and max 35 (give 0 score),
with 1 (1 year givae 2 score) to 5 (5 years give 10 score max) years experiences,
related working experience gives 5 score, contional 5 score and uncondition 10 score
*/
document.getElementById('TotalScore').value = sum.toFixed(0);
}
function getRBtnName(GrpName) {
var sel = document.getElementsByName(GrpName);
var fnd = -1;
var str = '';
for (var i=0; i<sel.length; i++) {
if (sel[i].checked == true) { str = sel[i].value; fnd = i; }
}
// return fnd; // return option index of selection
// comment out next line if option index used in line above <br/>
return str;
}
</script>
</head>
<body>
<h1 align="center"> Iraq Scholarship Application </h1>
<h3>This tool will allow you to calculate your scores for Scholarship</h3>
<table border="1">
<tr>
<td align="right">
<!-- What is the definition of "top"? Only one? Top 5? Top 10%? -->
Where you at top of your school when you graduated:
</td><td>
<input type="radio" name="topOfClass" value="Y"> Yes
<input type="radio" name="topOfClass" value="N"> No
</td>
</tr>
<tr>
<td align="right">
What is your total Bsc score (ex, 65):
</td><td>
<input type="text" name="BScScore" id="BScScore" value="0">
</td>
</tr>
<tr>
<td align="right">
What are you applying for:
</td><td>
<input type="radio" name="MScApply" value="MSc"> MSc
<input type="radio" name="MScApply" value="PhD"> PhD
</td>
</tr>
<tr>
<td align="right">
How many years of working experience do you have:
</td><td>
<input type="text" name="Experience" id="Experience" value="0">
</td>
</tr>
<tr>
<td align="right">
Is the study related to your working experience:
</td><td>
<input type="radio" name="Study" value="Y"> Yes
<input type="radio" name="Study" value="N"> No
</td>
</tr>
<tr>
<td align="right">
What type of offer do you have:
</td><td>
<input type="radio" name="Offer" value="C"> Conditional
<input type="radio" name="Offer" value="U"> Unconditional
</td>
</tr>
<tr>
<td align="right">
What is your age:
<br> Age, please round up/down to closest whole age,
<br> 25, 26, 27 ...(between min 25- max 40)
</td><td valign="top">
<input type="text" name="Age" id="Age" value="0">
</td>
</tr>
<tr>
<td align="right">
What is your testing language <br> and your score.
</td><td>
<input type="text" name="testLanguage" value=""><br>
<input type="text" name="LanguageScore" value="">
</td>
</tr>
</table>
<p>
Your total score for HCDP program is
<button onclick="ComputeScore()">Calculate</button>
<input type="text" name="TotalScore" id="TotalScore" value="" readonly>
</body>
</html>
<i>
</i><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> HCDP Scholarship Application - Kurdistan region </title>
<script type="text/javascript">
// From:
function $_(IDS) { return document.getElementById(IDS); }
function addOption(IDS,Item,itemValue) {
var sel = $_(IDS);
sel.options[sel.options.length]=new Option(Item,itemValue,true,true);
}
function removeAllOptions(SelectBox) {
var sel = $_(SelectBox);
for (var i=sel.options.length-1; i>=0; i--) { sel.remove(i); }
}
var TestLanguageList = ['PASSWORD','IELTS','TOEFL ITP','TOEFL COMPUTER','TOEFL IBT','TOEFL PAPER'];
var PasswordList = ['PP','6.0','5.5','5.0','4.5','4.0','3.5','3.0'];
var IELTSList = ['6.0','5.5','5.0','4.5','4.0','3.5','3.0','2.5'];
var TOEFLitpList = ['575','550','525','500','475','450','425','400'];
var TOEFLcomputerList = ['213','190','173','152','133','113','93','75'];
var TOEFLibtList = ['80','70','60','50','40','30','20','10'];
var TOEFLpaperList = ['550','525','500','475','450','425','400','375'];
function FillTestLanguage() {
// this function is used to fill the Testing Language list on load
for (var i=0; i<TestLanguageList.length; i++) {
addOption('TestLanguage',TestLanguageList[i],TestLanguageList[i]);
}
$_('TestLanguage').selectedIndex = 0;
}
function SelectYourScore() {
// ON selection of category this function will work
removeAllOptions('YourScore');
addOption('YourScore', "YourScore", "");
switch ($_('TestLanguage').value) {
case 'PASSWORD' :
for (var i=0; i<PasswordList.length; i++) {
addOption('YourScore',PasswordList[i],PasswordList[i]);
} break;
case 'IELTS' :
for (var i=0; i<IELTSList.length; i++) {
addOption('YourScore',IELTSList[i],IELTSList[i]);
} break;
case 'TOEFL ITP' :
for (var i=0; i<TOEFLitpList.length; i++) {
addOption('YourScore',TOEFLitpList[i],TOEFLitpList[i]);
} break;
case 'TOEFL COMPUTER' :
for (var i=0; i<TOEFLcomputerList.length; i++) {
addOption('YourScore',TOEFLcomputerList[i],TOEFLcomputerList[i]);
} break;
case "TOEFL IBT" :
for (var i=0; i<TOEFLibtList.length; i++) {
addOption('YourScore',TOEFLibtList[i],TOEFLibtList[i]);
} break;
case "TOEFL PAPER" :
for (var i=0; i<TOEFLpaperList.length; i++) {
addOption('YourScore',TOEFLpaperList[i],TOEFLpaperList[i]);
} break;
default : alert('Invalid selection'); break;
}
$_('YourScore').selectedIndex = 0;
}
var MScAgeList = ['25','26','27','28','29','30','31','32','33','34','35'];
var PhDAgeList = ['30','31','32','33','34','35','36','37','38','39','40'];
function populate_dropdown(setAge) {
removeAllOptions('your_Age');
switch(setAge) {
case "MSc":
for (var i=0; i<MScAgeList.length; i++) {
addOption('your_Age',MScAgeList[i],MScAgeList[i]);
} break;
case "PhD":
for (var i=0; i<PhDAgeList.length; i++) {
addOption('your_Age',PhDAgeList[i],PhDAgeList[i]);
} break;
default:
addOption('your_Age','Select MSc or PhD first', "");
break;
}
$_('your_Age').selectedIndex = 0;
}
// From: http://www.webdeveloper.com/forum/showthread.php?t=239477
// ONLY PARTIALLY COMPLETE AT THIS TIME! SEE LOGIC COMMENT BELOW.
function ComputeScore() {
var tmp = 0;
bscScore = Number(document.getElementById('BScScore').value); if (isNaN(bscScore)) { bscScore = 0; }
var sum = 0;
// get Age
var Age = Number(document.getElementById('your_Age').value);
if ((Age < 25) || (Age > 40)) { alert('Not eligible due to age requirements'); return; }
$_('Score10').value = sum;
/*
if "topOfClass" = yes and under "BSc" = 65 they get 25 score,
if no and 65 then they get 25, but plus one score for any whole number over 65, a 66 gets 26, 67 gets 27 ...
*/
if (getRBtnName('topOfClass') == "Y") {
sum += 25;
} else {
if (bscScore >= 65) { sum += 25; }
if (bscScore > 65) { sum += bscScore - 65; }
}
$_('Score20').value = sum;
// add years of experience
var Exp = Number(document.getElementById('Experience').value); if (isNaN(Exp)) { Exp = 0; }
sum += Exp;
$_('Score30').value = sum;
/*
Following LOGIC is confusing to me ... Clarification is needed ... ???
IF Msc and aged between min 25 (give 15 score) and max 35 (give 0 score),
with 1 (1 year givae 2 score) to 5 (5 years give 10 score max) years experiences,
related working experience gives 5 score, contional 5 score and uncondition 10 score
*/
$_('Score40').value = sum;
$_('Score50').value = sum;
$_('Score60').value = sum;
/* No changes to score as LOGIC is confusing to me ... Clarification is needed ... ??? */
document.getElementById('TotalScore').value = sum.toFixed(0);
}
function getRBtnName(GrpName) {
var sel = document.getElementsByName(GrpName);
var fnd = -1;
var str = '';
for (var i=0; i<sel.length; i++) {
if (sel[i].checked == true) { str = sel[i].value; fnd = i; }
}
// return fnd; // return option index of selection
// comment out next line if option index used in line above <br/>
return str;
}
</script>
</head>
<body onLoad="FillTestLanguage();">
<h1 align="center">HCDP Scholarship Application</h1>
<h3>This tool will allow you to calculate your scores for Scholarship</h3>
<form action="HCDP_Scores" method="post" onsubmit="return false">
<table border="1">
<tr>
<td align="right">
<!-- What is the definition of "top"? Only one? Top 5? Top 10%? -->
Where you at top of your school when you graduated:
</td>
<td>
<input type="radio" name="topOfClass" value="Y"> Yes
<input type="radio" name="topOfClass" value="N"> No
</td>
<td valign="top"> <p>&nbsp;</p> </td>
</tr>
<tr>
<td align="right"> What is your total Bsc score (ex, 65): </td>
<td> <input type="text" name="BScScore" id="BScScore" value="0"> </td>
<td valign="top">
<!-- CANNOT EVER DO ANYTHING IF INPUT IS SET TO readonly !!! and calculate() is not defined -->
<input type="text" id="Score10" name="Score10" size="12" tabindex="10" onChange="calculate()" readonly>
</td>
</tr>
<tr>
<td align="right"> What are you applying for: </td>
<td>
<input id="MSc" type="radio" name="setAge" value="MSc" onClick="populate_dropdown('MSc')" /><label for="MSc">MSc</label>
<input id="PhD" type="radio" name="setAge" value="PhD" onClick="populate_dropdown('PhD')" /><label for="PhD">PhD</label>
</td>
<td valign="top"> <p>&nbsp;</p> </td>
</tr>
<tr>
<td align="right"> What is your age:
<br> Age, please round up/down to closest whole age,
<br> 25, 26, 27 ...(between min 25- max 40)
</td>
<td valign="top">
<select id="your_Age" name="your_Age">
<option>Select MSc/PhD first</option>
</select>
</td>
<td valign="top">
<!-- CANNOT EVER DO ANYTHING IF INPUT IS SET TO readonly !!! and calculate() is not defined -->
<input type="text" id="Score20" name="Score20" size="12" tabindex="20" onChange="calculate()" readonly>
</td>
</tr>
<tr>
<td align="right"> How many years of working experience do you have: </td>
<td>
<select id="Experience" name="Experience" size="1">
<option value="0">0</option> <option value="1">1</option>
<option value="2">2</option> <option value="3">3</option>
<option value="4">4</option> <option value="5">5</option>
<option value="6">6</option> <option value="7">7</option>
<option value="8">8</option> <option value="9">9</option>
<option value="10">10</option>
</select>
</td>
<td valign="top">
<!-- CANNOT EVER DO ANYTHING IF INPUT IS SET TO readonly !!! and calculate() is not defined -->
<input type="text" id="Score30" name="Score30" size="12" tabindex="30" onChange="calculate()" readonly>
</td>
</tr>
<tr>
<td align="right"> Is the study related to your working experience: </td>
<td>
<input type="radio" name="Study" value="Y"> Yes
<input type="radio" name="Study" value="N"> No
</td>
<td valign="top">
<!-- CANNOT EVER DO ANYTHING IF INPUT IS SET TO readonly !!! and calculate() is not defined -->
<input type="text" id="Score40" name="Score40" size="12" tabindex="40" onChange="calculate()" readonly>
</td>
</tr>
<tr>
<td align="right"> What type of offer do you have: </td>
<td>
<input type="radio" name="Offer" value="C"> Conditional
<input type="radio" name="Offer" value="U"> Unconditional
</td>
<td valign="top">
<!-- CANNOT EVER DO ANYTHING IF INPUT IS SET TO readonly !!! and calculate() is not defined -->
<input type="text" id="Score50" name="Score50" size="12" tabindex="50" onChange="calculate()" readonly>
</td>
</tr>
<tr>
<td align="right"> What is your testing language <br> and your score. </td>
<td>
<SELECT id="TestLanguage" NAME="TestLanguage" onChange="SelectYourScore();" >
<Option value="">Testing Language</option>
</SELECT>&nbsp;
<SELECT id="YourScore" NAME="YourScore"> <Option value="">Your Score</option> </SELECT>
</td>
<td valign="top">
<!-- CANNOT EVER DO ANYTHING IF INPUT IS SET TO readonly !!! and calculate() is not defined -->
<input type="text" id="Score60" name="Score60" size="12" tabindex="60" onChange="calculate()" readonly>
</td>
</tr>
<tr>
<td> Your total score for HCDP program is: </td>
<td> <button onclick="ComputeScore()">Calculate</button> </td>
<td> <input type="text" name="TotalScore" id="TotalScore" size="15" tabindex="100" readonly> </td>
</tr>
</table>
</form>
</body>
</html>
<i>
</i> var studyInfo = getRBtnName('Study');
/*
Following LOGIC is confusing to me ... Clarification is needed ... ???
IF Msc and aged between min 25 (give 15 score) and max 35 (give 0 score),
with 1 (1 year givae 2 score) to 5 (5 years give 10 score max) years experiences,
related working experience gives 5 score, contional 5 score and uncondition 10 score
*/
[/quote]
<i>
</i><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> HCDP Scholarship Application - Kurdistan region </title>
<script type="text/javascript">
// From: http://www.webdeveloper.com/forum/showthread.php?p=1130042#post1130042
function $_(IDS) { return document.getElementById(IDS); }
function addOption(IDS,Item,itemValue) {
var sel = $_(IDS);
sel.options[sel.options.length]=new Option(Item,itemValue,true,true);
}
function removeAllOptions(SelectBox) {
var sel = $_(SelectBox);
for (var i=sel.options.length-1; i>=0; i--) { sel.remove(i); }
}
var TestLanguageList = ['PASSWORD','IELTS','TOEFL ITP','TOEFL COMPUTER','TOEFL IBT','TOEFL PAPER'];
var PasswordList = ['PP:10','6.0:10','5.5:8','5.0:8','4.5:6','4.0:6','3.5:4','3.0:4'];
var IELTSList = ['6.0:10','5.5:10','5.0:8','4.5:8','4.0:6','3.5:6','3.0:4','2.5:4'];
var TOEFLitpList = ['575:10','550:10','525:8','500:8','475:6','450:6','425:4','400:4'];
var TOEFLcomputerList = ['213:10','190:10','173:8','152:8','133:6','113:6','93:4','75:4'];
var TOEFLibtList = ['80:10','70:10','60:8','50:8','40:6','30:6','20:4','10:4'];
var TOEFLpaperList = ['550:10','525:10','500:8','475:8','450:6','425:6','400:4','375:4'];
function FillTestLanguage() {
for (var i=0; i<TestLanguageList.length; i++) {
addOption('TestLanguage',TestLanguageList[i],TestLanguageList[i]);
} $_('TestLanguage').selectedIndex = 0;
}
function SelectYourScore() {
removeAllOptions('YourScore');
addOption('YourScore', "YourScore", "");
var tarr = [];
switch ($_('TestLanguage').value) {
case 'PASSWORD' :
for (var i=0; i<PasswordList.length; i++) {
tarr = PasswordList[i].split(':'); addOption('YourScore',tarr[0],tarr[1]);
} break;
case 'IELTS' :
for (var i=0; i<IELTSList.length; i++) {
tarr = IELTSList[i].split(':'); addOption('YourScore',tarr[0],tarr[1]);
} break;
case 'TOEFL ITP' :
for (var i=0; i<TOEFLitpList.length; i++) {
tarr = TOEFLitpList[i].split(':'); addOption('YourScore',tarr[0],tarr[1]);
} break;
case 'TOEFL COMPUTER' :
for (var i=0; i<TOEFLcomputerList.length; i++) {
tarr = TOEFLcomputerList[i].split(':'); addOption('YourScore',tarr[0],tarr[1]);
} break;
case "TOEFL IBT" :
for (var i=0; i<TOEFLibtList.length; i++) {
tarr = TOEFLibtList[i].split(':'); addOption('YourScore',tarr[0],tarr[1]);
} break;
case "TOEFL PAPER" :
for (var i=0; i<TOEFLpaperList.length; i++) {
tarr = TOEFLpaperList[i].split(':'); addOption('YourScore',tarr[0],tarr[1]);
} break;
default : alert('Invalid selection'); break;
}
$_('YourScore').selectedIndex = 0;
}
var MScAgeList = ['25','26', '27','28', '29','30', '31','32', '33','34', '35'];
var PhDAgeList = ['30','31', '32','33', '34','35', '36','37', '38','39', '40'];
var AgePoints = ['15','13.5','12','10.5', '9', '7.5','6', '4.5','4', '1.5','0'];
function populate_dropdown(setAge) {
removeAllOptions('your_Age');
switch(setAge) {
case "MSc":
for (var i=0; i<MScAgeList.length; i++) {
addOption('your_Age',MScAgeList[i],MScAgeList[i]);
} break;
case "PhD":
for (var i=0; i<PhDAgeList.length; i++) {
addOption('your_Age',PhDAgeList[i],PhDAgeList[i]);
} break;
default:
addOption('your_Age','Select MSc or PhD first', "");
break;
} $_('your_Age').selectedIndex = 0;
}
function ComputeScore() {
var tmp = 0;
bscScore = Number($_('BScScore').value); if (isNaN(bscScore)) { bscScore = 0; }
var sum = 0;
// get Age
var Age = Number($_('your_Age').value);
if ((Age < 25) || (Age > 40)) { alert('Not eligible due to age requirements'); return; }
// Stage 1 calculations: determine start score base on TOC or BSc score
if (getRBtnName('topOfClass') == "Y") { sum = 25; } // top of class get score of 25 only
if (bscScore >= 65) { sum = 25 + bscScore - 65; } // not top of class but score 65 or over
// else { alert('Not eligible for scholarship'); return }
$_('Score10').value = sum;
// Stage 2 calculations: MSc or PhD and age modifications
sum += Number(AgePoints[$_('your_Age').selectedIndex]); <br/>
$_('Score20').value = sum;
// Stage 3 calculations: add work experience
var Exp = Number($_('myExperience').value); <br/>
if (isNaN(Exp)) { Exp = 0; }
sum += Exp;
$_('Score30').value = sum;
// Stage 4 calculations: Study related to experience = +5 points;
tmp = Number(getRBtnName('myStudy')); if (isNaN(tmp)) { tmp = 0; }
sum += tmp;
$_('Score40').value = sum;
// Stage 5 calculations: Conditional vs Unconditional acceptance
tmp = Number(getRBtnName('myOffer')); if (isNaN(tmp)) { tmp = 0; }
sum += tmp;
$_('Score50').value = sum;
// Stage 6 calculations: Language skills adjustment
tmp = Number($_('YourScore').value); if (isNaN(tmp)) { tmp = 0; }
sum += tmp;
$_('Score60').value = sum;
$_('TotalScore').value = sum.toFixed(0);
}
function getRBtnName(GrpName) {
var sel = document.getElementsByName(GrpName);
var fnd = -1;
var str = '';
for (var i=0; i<sel.length; i++) {
if (sel[i].checked == true) { str = sel[i].value; fnd = i; }
}
// return fnd; // return option index of selection
// comment out next line if option index used in line above <br/>
return str;
}
</script>
</head>
<body onLoad="FillTestLanguage();">
<h1 align="center">HCDP Scholarship Application</h1>
<h3>This tool will allow you to calculate your scores for Scholarship</h3>
<form name="HCDP_Form" action="HCDP_Scores" method="post" onsubmit="return false">
<table border="1">
<tr>
<td align="right">
Where you at top of your school when you graduated:
</td>
<td>
<input type="radio" name="topOfClass" value="Y" onclick="ComputeScore()"> Yes
<input type="radio" name="topOfClass" value="N" onclick="ComputeScore()" checked> No
</td>
<td valign="top"> <p>&nbsp;</p> </td>
</tr>
<tr>
<td align="right"> What is your total Bsc score (ex, 65): </td>
<td> <input type="text" name="BScScore" id="BScScore" value="0" onblur="ComputeScore()"> </td>
<td valign="top">
<input type="text" id="Score10" name="Score10" size="6" tabindex="10" readonly> Stage 1
</td>
</tr>
<tr>
<td align="right"> What are you applying for: </td>
<td>
<label>
<input id="MSc" type="radio" name="setAge" value="MSc" onClick="populate_dropdown('MSc')" /> MSc
</label>
<label>
<input id="PhD" type="radio" name="setAge" value="PhD" onClick="populate_dropdown('PhD')" /> PhD
</label>
</td>
<td valign="top"> <p>&nbsp;</p> </td>
</tr>
<tr>
<td align="right"> What is your age?
</td>
<td valign="top">
<select id="your_Age" name="your_Age" onchange="ComputeScore()">
<option>Select MSc/PhD first</option>
</select>
</td>
<td valign="top">
<input type="text" id="Score20" name="Score20" size="6" tabindex="20" readonly> Stage 2
</td>
</tr>
<tr>
<td align="right"> How many years of working experience do you have: </td>
<td>
<select id="myExperience" name="myExperience" size="1" onchange="ComputeScore()">
<option value="0" selected>0</option>
<option value="2">1</option> <option value="4">2</option>
<option value="6">3</option> <option value="8">4</option>
<option value="10">5</option>
</select>
</td>
<td valign="top">
<input type="text" id="Score30" name="Score30" size="6" tabindex="30" readonly> Stage 3
</td>
</tr>
<tr>
<td align="right"> Is the study related to your working experience: </td>
<td>
<span onclick="ComputeScore()">
<label> <input type="radio" name="myStudy" value="5"> YES </label>
<label> <input type="radio" name="myStudy" value="0"> NO </label>
</span>
</td>
<td valign="top">
<input type="text" tabindex="40" id="Score40" name="Score40" size="6" readonly> Stage 4
</td>
</tr>
<tr>
<td align="right"> What type of offer do you have: </td>
<td>
<span onClick='ComputeScore()'>
<label> <input type="radio" name="myOffer" value="0" checked> None </label>
<label> <input type="radio" name="myOffer" value="5"> Conditional </label>
<label> <input type="radio" name="myOffer" value="10"> Unconditional </label>
</span>
</td>
<td valign="top">
<input type="text" id="Score50" name="Score50" size="6" tabindex="50" readonly> Stage 5
</td>
</tr>
<tr>
<td align="right"> What is your testing language and your score. </td>
<td>
<SELECT id="TestLanguage" NAME="TestLanguage" onChange="SelectYourScore();" >
<Option value="">Testing Language</option>
</SELECT>&nbsp;
<SELECT id="YourScore" NAME="YourScore" onchange="ComputeScore()">
<Option value="">Your Score</option>
</SELECT>
</td>
<td valign="top">
<input type="text" id="Score60" name="Score60" size="6" tabindex="60" readonly> Stage 6
</td>
</tr>
<tr>
<td> Your total score for HCDP program is: </td>
<td valign="top"> <button onclick="ComputeScore()">Calculate</button> </td>
<td> <input type="text" name="TotalScore" id="TotalScore" size="15" tabindex="100" readonly>
</tr>
</table>
</form>
</body>
</html>
<i>
</i>// Stage 3 calculations: add work experience
tmp = Number($_('myExperience').value); if (isNaN(tmp)) { tmp = 0; }
sum += tmp;
$_('Score30').value = tmp;
// Stage 4 calculations: Study related to experience = +5 points;
tmp = Number(getRBtnName('myStudy')); if (isNaN(tmp)) { tmp = 0; }
sum += tmp;
$_('Score40').value = tmp;
// Stage 5 calculations: Conditional vs Unconditional acceptance
tmp = Number(getRBtnName('myOffer')); if (isNaN(tmp)) { tmp = 0; }
sum += tmp;
$_('Score50').value = tmp;
// Stage 6 calculations: Language skills adjustment
tmp = Number($_('YourScore').value); if (isNaN(tmp)) { tmp = 0; }
sum += tmp;
$_('Score60').value = tmp;
$_('TotalScore').value = sum.toFixed(0);
}
no I do not have any experience, This my first attempt. I can read the code and what it suppose to do. I do not consider myself a programmer but love to learn
This is perfect
http://drupal.kurdan.net/sites/all/themes/ministry/hcdp_score_13.html
Still adds Stage one and two together
Do we still need calc button? can I remove it.[/QUOTE]
<i>
</i> var MScAgeList = ['0','25','26', '27','28', '29','30', '31','32', '33','34', '35'];
var PhDAgeList = ['0','30','31', '32','33', '34','35', '36','37', '38','39', '40'];
var AgePoints = ['0','15','13.5','12','10.5', '9', '7.5','6', '4.5','4', '1.5','0'];
function populate_dropdown(setAge) {
removeAllOptions('your_Age');
switch(setAge) {
case "MSc":
addOption('your_Age','Choose your age:', "");
for (var i=1; i<MScAgeList.length; i++) {
addOption('your_Age',MScAgeList[i],MScAgeList[i]);
} break;
case "PhD":
addOption('your_Age','Choose your age:', "");
for (var i=1; i<PhDAgeList.length; i++) {
addOption('your_Age',PhDAgeList[i],PhDAgeList[i]);
} break;
default:
addOption('your_Age','Select MSc or PhD first', "");
break;
} $_('your_Age').selectedIndex = 0;
}
0.1.9 — BETA 5.5