Herkeze Slm javascript ile gpa cgpa hesapla fonksiyonu yazıyorum hesaplatmalarını yaptırabildim orda sorun yok. ama benim tam olarak elde etmek istediğim şey code göreceksiniz kutsu tikli olanları hesaplatırmayı bir türlü beceremedim ne mantık yürüttüysem tıkandım bir ikinciside tekrar edilen dersvar ise yes seceneğinine tıkladıgında eski notuda hesaba katacak no tıklarsan normal bir şekilde devam etmeyi de bir türlü ayarlayamadım yardımcı olursanız yadabir yol gösterirseniz ben tamamlarım
<html> <head>
<title>Calculate your GPA</title>
<script type = "text/javascript">
//function to set the focus on GPA form function setFocus() { document.GPA.focus(); return; }
//functio to round 2 decimal points function round(n){return(.01* Math.round(100*n));}
//function to calculate gpa function calculate(fr) { //checking if all credit hours equal to zero if (fr.CH1.selectedIndex=="0" && fr.CH2.selectedIndex=="0" && fr.CH3.selectedIndex=="0" && fr.CH4.selectedIndex=="0" && fr.CH5.selectedIndex=="0" && fr.CH6.selectedIndex=="0" ) {alert ("Please specify your credit hours") } else //calculating var resultgpa;
<td align = "center" width = "70"> <select name= "grade1"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F </select></td>
<td align = "center"> <select name= "g1"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F
<td align = "center"> <select name= "grade2"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F
</select></td> <td><center> <input type="radio" name="2" id="y" value="yes">Yes <input type="radio" name="2" id="n" value="no">No </center></td> <td align = "center" width = "70"> <select name= "g2"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F </select></td> </tr>
<td align = "center"> <select name= "grade3"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F
</select></td> <td><center> <input type="radio" name="3" id="y" value="yes">Yes <input type="radio" name="3" id="n" value="no">No </center></td> <td align = "center" width = "70"> <select name= "g3"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F </select></td> </tr>
<td align = "center"> <select name= "grade4"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F
</select></td> <td><center> <input type="radio" name="4" id="y" value="yes">Yes <input type="radio" name="4" id="n" value="no">No </center></td> <td align = "center" width = "70"> <select name= "g4"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F </select></td> </tr>
<td align = "center"> <select name= "grade5"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F
</select></td> <td><center> <input type="radio" name="5" id="y" value="yes">Yes <input type="radio" name="5" id="n" value="no">No </center></td> <td align = "center" width = "70"> <select name= "g5"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F </select></td> </tr>
<td align = "center"> <select name= "grade6"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F
</select>
</td> <td><center> <input type="radio" name="6" id="y" value="yes">Yes <input type="radio" name="6" id="n" value="no">No </center></td> <td align = "center" width = "70"> <select name= "g6"> <option value = "5" SELECTED>Select <option value = "4">A <option value = "3.70">A- <option value = "3.30">B+ <option value = "3">B <option value = "2.70">B- <option value = "2.30">C+ <option value = "2">C <option value = "1.70">C- <option value = "1.30">D+ <option value = "1">D <option value = "0.7">D- <option value = "0">F </select></td> </tr> </table>
<!--sending information to calculate() function-->
<!--getting back result from function--> <tr><td><p align="center"style="font-size:16pt"><b>Your GPA will be:</b></p></td> <td align="right"><input type = text name="resultgpa"></td></tr>
<!--getting back result from function--> <tr><td><p align="center"style="font-size:16pt"><b>Your CPGA Will Be:</b></p></td> <td align="right"><input type = text name="resultcgpa"></td></tr>
<tr><td><input type = "button" value = "Calculate!" onclick = "calculate(this.form)" name = "bottun"></td>