Selasa, 25 Maret 2014

Pemrograman Web Menghitung Nilai Akhir

<html>
  <head>
    <title>Cetak_Nilai</title>
     <script LANGUAGE="JavaScript">
function cek(){
if(form.ntugas.value == "" || form.nuts.value == "" || form.nuas.value == ""){
alert("data kosong");
exit;
}
}
function nilai(){
cek();
nt=eval(form.ntugas.value);
nut=eval(form.nuts.value);
nua=eval(form.nuas.value);
nakh=(2*nt+3*nut+5*nua)/10;
if(nakh>=80)
 bobot=4;
else if(nakh<80 && nakh>=70)
  bobot=3;
else if(nakh<70 && nakh>=60)
  bobot=2;
else if(nakh<60 && nakh>=50)
  bobot=1;
else
  bobot=0;
form.nakhir.value=nakh;
form.bobot.value=bobot;
}
function reset() {
form.ntugas.value="";
form.nuts.value="";
form.nuas.value = "";
form.nakhir.value= "";
form.bobot.value= "";
}
</script>
  </head>
    <body>

      <form name="form">
       Nilai Tugas </td><td><input type=text name="ntugas" size=2><br>
              Nilai UTS </td><td><input type=text name="nuts" size=2><br>
             Nilai UAS <input type=text name="nuas" size=2><br>
            <input type=button name=submit onclick="nilai()" value="Hasil">
           <input type=button name=submit onclick="reset()" value="Reset"><br><br>
       Nilai Akhir<input type=text name="nakhir" value="" size=5><br>
       Bobot <input type=text name="bobot" value="" size=2><br>
      </form>
    </body>
</html>



Tidak ada komentar: