Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[HELP] VBscript in html (kira markah gpa)
14-02-2013, 04:13 PM,
Post: #1
[HELP] VBscript in html (kira markah gpa)
salam geng, aku ada buat 1 assignment ni.. tadi aku stuck sikit lah.. dah mati akal dah.. ada sapa2 leh tlg tak ?

Code:
<html>
<head>

Academic Performance Form
<p>
Part A
<p>


Name:<input type="text" name="name" size="70"/><br>
Student ID:<input type="text" name="student" size="70"/><br>
I.C/Passport Number:<input type="text" name="ic" size="70"/><br>
Race:<input type="text" name="race" size="70"/><br>
Religion:<input type="text" name="religion" size="70"/><br>
Nationality:<input type="text" name="nationality" size="70"/><br>
Gender (Male/Female):<input type="text" name="gender" size="70"/><br>
Home Address:<input type="text" name="address" size="70"/><br>

             <input type="text" name="address" size="70"/><br>

             <input type="text" name="address" size="70"/><br>

Mobile Number:<input type="text" name="address" size="70"/><br>
Email Address:<input type="text" name="email" size="70"/><br>
Faculty:<input type="text" name="faculty" size="70"/><br>
Program (e.g. Bachelor of Arts):<input type="text" name="program" size="70"/><br>
Study Mode ( Full/Part time):<input type="text" name="study" size="70"/><br>
You are in Semester:<input type="text" name="semester" size="70"/><br>
Semester ( Jan/May/Sept) & Year:<input type="text" name="semester" size="70"/><br>


</body>
</html>


<HTML>
<HEAD>
<TITLE>Grade Calculator - VBScript</TITLE>

<br>
Part B
</b>
<p>



<script language="vbscript">
sub calculate_onclick



if len(form1.coursecode1.value)<2 or IsNumeric(form1.coursecode1.value)then
   msgbox("Incorrect data entered or field is blank for coursecode")
   form.txtName.focus
   form.txtName.select
end if
  
if len(form1.coursecode2.value)<2 or IsNumeric(form1.coursecode2.value)then
   msgbox("Incorrect data entered or field is blank for coursecode")
   form.txtName.focus
   form.txtName.select
end if
  
if len(form1.coursecode3.value)<2 or IsNumeric(form1.coursecode3.value)then
   msgbox("Incorrect data entered or field is blank for coursecode")
   form.txtName.focus
   form.txtName.select
end if
  
if len(form1.coursecode4.value)<2 or IsNumeric(form1.coursecode4.value)then
   msgbox("Incorrect data entered or field is blank for coursecode")
   form.txtName.focus
   form.txtName.select
end if


  



if len(form1.coursename1.value)<2 or IsNumeric(form1.coursename1.value)then
   msgbox("Incorrect data entered or field is blank for coursename")
   form.txtName.focus
   form.txtName.select
end if

if len(form1.coursename2.value)<2 or IsNumeric(form1.coursename2.value)then
   msgbox("Incorrect data entered or field is blank for coursename")
   form.txtName.focus
   form.txtName.select
end if

if len(form1.coursename3.value)<2 or IsNumeric(form1.coursename3.value)then
   msgbox("Incorrect data entered or field is blank for coursename")
   form.txtName.focus
   form.txtName.select
end if

if len(form1.coursename4.value)<2 or IsNumeric(form1.coursename4.value)then
   msgbox("Incorrect data entered or field is blank for coursename")
   form.txtName.focus
   form.txtName.select
end if




if isNumeric(form1.Marks1.value)then
   Marks1=CInt(form1.Marks1.value)
else
   myMessage="Incorrect data entered or field is blank for Mark"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.Marks2.value)then
   Marks2=CInt(form1.Marks2.value)
else
   myMessage="Incorrect data entered or field is blank for Mark"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.Marks3.value)then
   Marks3=CInt(form1.Marks3.value)
else
   myMessage="Incorrect data entered or field is blank for Mark"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.Marks4.value)then
   Marks4=CInt(form1.Marks4.value)
else
   myMessage="Incorrect data entered or field is blank for Mark"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if




if isNumeric(form1.credit1.value)then
   credit1=CInt(form1.credit1.value)
else
   myMessage="Incorrect data entered or field is blank for credit hour"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.credit2.value)then
   credit2=CInt(form1.credit2.value)
else
   myMessage="Incorrect data entered or field is blank for credit hour"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.credit3.value)then
  credit3=CInt(form1.credit3.value)
else
   myMessage="Incorrect data entered or field is blank for credit hour"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.credit4.value)then
   credit4=CInt(form1.credit4.value)
else
   myMessage="Incorrect data entered or field is blank for credit hour"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if



if marks1 >= 80  then
   form1.gradepoint1.value = "4.00"
elseif marks1 >= 75 and marks1 <= 79 then
   form1.gradepoint1.value = "3.67"
elseif marks1 >= 70 and marks1 <= 74 then
   form1.gradepoint1.value = "3.33"
elseif marks1 >= 65 and marks1 <= 69 then
   form1.gradepoint1.value = "3.00"
elseif marks1 >= 60 and marks1 <= 64 then
   form1.gradepoint1.value = "2.67"
elseif marks1 >= 55 and marks1 <= 59 then
   form1.gradepoint1.value = "2.33"
elseif marks1 >= 50 and marks1 <= 54 then
   form1.gradepoint1.value = "2.00"
elseif marks1 >= 45 and marks1 <= 49 then
   form1.gradepoint1.value = "1.67"
elseif marks1 >= 40 and marks1 <= 44 then
   form1.gradepoint1.value = "1.33"
elseif marks1 >= 35 and marks1 <= 39 then
   form1.gradepoint1.value = "1.00"
elseif marks1 >= 00 and marks1 <= 34 then  
   form1.gradepoint1.value = "0.00"
end if

if marks2 >= 80  then
   form1.gradepoint2.value = "4.00"
elseif marks2 >= 75 and marks2 <= 79 then
   form1.gradepoint2.value = "3.67"
elseif marks2 >= 70 and marks2 <= 74 then
   form1.gradepoint2.value = "3.33"
elseif marks2 >= 65 and marks2 <= 69 then
   form1.gradepoint2.value = "3.00"
elseif marks2 >= 60 and marks2 <= 64 then
   form1.gradepoint2.value = "2.67"
elseif marks2 >= 55 and marks2 <= 59 then
   form1.gradepoint2.value = "2.33"
elseif marks2 >= 50 and marks2 <= 54 then
   form1.gradepoint2.value = "2.00"
elseif marks2 >= 45 and marks2 <= 49 then
   form1.gradepoint2.value = "1.67"
elseif marks2 >= 40 and marks2 <= 44 then
   form1.gradepoint2.value = "1.33"
elseif marks2 >= 35 and marks2 <= 39 then
   form1.gradepoint2.value = "1.00"
elseif marks2 >= 00 and marks2 <= 34 then  
   form1.gradepoint2.value = "0.00"
end if

if marks3 >= 80  then
   form1.gradepoint3.value = "4.00"
elseif marks3 >= 75 and marks3 <= 79 then
   form1.gradepoint3.value = "3.67"
elseif marks3 >= 70 and marks3 <= 74 then
   form1.gradepoint3.value = "3.33"
elseif marks3 >= 65 and marks3 <= 69 then
   form1.gradepoint3.value = "3.00"
elseif marks3 >= 60 and marks3 <= 64 then
   form1.gradepoint3.value = "2.67"
elseif marks3 >= 55 and marks3 <= 59 then
   form1.gradepoint3.value = "2.33"
elseif marks3 >= 50 and marks3 <= 54 then
   form1.gradepoint3.value = "2.00"
elseif marks3 >= 45 and marks3 <= 49 then
   form1.gradepoint3.value = "1.67"
elseif marks3 >= 40 and marks3 <= 44 then
   form1.gradepoint3.value = "1.33"
elseif marks3 >= 35 and marks3 <= 39 then
   form1.gradepoint3.value = "1.00"
elseif marks3 >= 00 and marks3 <= 34 then  
   form1.gradepoint3.value = "0.00"
end if

if marks4 >= 80  then
   form1.gradepoint4.value = "4.00"
elseif marks4 >= 75 and marks4 <= 79 then
   form1.gradepoint4.value = "3.67"
elseif marks4 >= 70 and marks4 <= 74 then
   form1.gradepoint4.value = "3.33"
elseif marks4 >= 65 and marks4 <= 69 then
   form1.gradepoint4.value = "3.00"
elseif marks4 >= 60 and marks4 <= 64 then
   form1.gradepoint4.value = "2.67"
elseif marks4 >= 55 and marks4 <= 59 then
   form1.gradepoint4.value = "2.33"
elseif marks4 >= 50 and marks4 <= 54 then
   form1.gradepoint4.value = "2.00"
elseif marks4 >= 45 and marks4 <= 49 then
   form1.gradepoint4.value = "1.67"
elseif marks4 >= 40 and marks4 <= 44 then
   form1.gradepoint4.value = "1.33"
elseif marks4 >= 35 and marks4 <= 39 then
   form1.gradepoint4.value = "1.00"
elseif marks4 >= 00 and marks4 <= 34 then  
   form1.gradepoint4.value = "0.00"
end if



if marks1>= 80  then
   form1.grade1.value = "A"
elseif marks1 >= 75 and marks1 <= 79 then
   form1.grade1.value = "A-"
elseif marks1 >= 70 and marks1 <= 74 then
   form1.grade1.value = "B+"
elseif marks1 >= 65 and marks1 <= 69 then
   form1.grade1.value = "B"
elseif marks1 >= 60 and marks1 <= 64 then
   form1.grade1.value = "B-"
elseif marks1 >= 55 and marks1 <= 59 then
   form1.grade1.value = "C+"
elseif marks1 >= 50 and marks1 <= 54 then
   form1.grade1.value = "C"
elseif marks1 >= 45 and marks1 <= 49 then
   form1.grade1.value = "C-"
elseif marks1 >= 40 and marks1 <= 44 then
   form1.grade1.value = "D+"
elseif marks1 >= 35 and marks1 <= 39 then
   form1.grade1.value = "D"
elseif marks1 >= 00 and marks1 <= 34 then  
   form1.grade1.value = "F"
end if

if marks2>= 80  then
   form1.grade2.value = "A"
elseif marks2 >= 75 and marks2 <= 79 then
   form1.grade2.value = "A-"
elseif marks2 >= 70 and marks2 <= 74 then
   form1.grade2.value = "B+"
elseif marks2 >= 65 and marks2 <= 69 then
   form1.grade2.value = "B"
elseif marks2 >= 60 and marks2 <= 64 then
   form1.grade2.value = "B-"
elseif marks2 >= 55 and marks2 <= 59 then
   form1.grade2.value = "C+"
elseif marks2 >= 50 and marks2 <= 54 then
   form1.grade2.value = "C"
elseif marks2 >= 45 and marks2 <= 49 then
   form1.grade2.value = "C-"
elseif marks2 >= 40 and marks2 <= 44 then
   form1.grade2.value = "D+"
elseif marks2 >= 35 and marks2 <= 39 then
   form1.grade2.value = "D"
elseif marks2 >= 00 and marks2 <= 34 then  
   form1.grade2.value = "F"
end if

if marks3>= 80  then
   form1.grade3.value = "A"
elseif marks3 >= 75 and marks3 <= 79 then
   form1.grade3.value = "A-"
elseif marks3 >= 70 and marks3 <= 74 then
   form1.grade3.value = "B+"
elseif marks3 >= 65 and marks3 <= 69 then
   form1.grade3.value = "B"
elseif marks3 >= 60 and marks3 <= 64 then
   form1.grade3.value = "B-"
elseif marks3 >= 55 and marks3 <= 59 then
   form1.grade3.value = "C+"
elseif marks3 >= 50 and marks3 <= 54 then
   form1.grade3.value = "C"
elseif marks3 >= 45 and marks3 <= 49 then
   form1.grade3.value = "C-"
elseif marks3 >= 40 and marks3 <= 44 then
   form1.grade3.value = "D+"
elseif marks3 >= 35 and marks3 <= 39 then
   form1.grade3.value = "D"
elseif marks3 >= 00 and marks3 <= 34 then  
   form1.grade3.value = "F"
end if

if marks4>= 80  then
   form1.grade4.value = "A"
elseif marks4 >= 75 and marks4 <= 79 then
   form1.grade4.value = "A-"
elseif marks4 >= 70 and marks4 <= 74 then
   form1.grade4.value = "B+"
elseif marks4 >= 65 and marks4 <= 69 then
   form1.grade4.value = "B"
elseif marks4 >= 60 and marks4 <= 64 then
   form1.grade4.value = "B-"
elseif marks4 >= 55 and marks4 <= 59 then
   form1.grade4.value = "C+"
elseif marks4 >= 50 and marks4 <= 54 then
   form1.grade4.value = "C"
elseif marks4 >= 45 and marks4 <= 49 then
   form1.grade4.value = "C-"
elseif marks4 >= 40 and marks4 <= 44 then
   form1.grade4.value = "D+"
elseif marks4 >= 35 and marks4 <= 39 then
   form1.grade4.value = "D"
elseif marks4 >= 00 and marks4 <= 34 then  
   form1.grade4.value = "F"
end if




overall=(form1.gradepoint1.value*credit1)+(form1.gradepoint2.value*credit2)+(form1.gradepoint3.value*credit3)+(form1.gradepoint4.value*credit4)
overall=round(overall,2)
form1.overall.value=overall

gpa=form1.overall.value/(credit1+credit2+credit3+credit4)
gpa=round(gpa,2)
form1.gpa.value=gpa


end sub
</script>

</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="000000" LINK="#FF0000"
<H2>Grade Point Average (GPA) Calculator</H2>
<form name = "form1" method = "post">


<input type="text" value="Num" size="1"><input type="text" value="CourseName " size="30"><input type="text" value="CourseCode " size="12"><input type="text" name="Marks" value="Mark" size="5"/><input type="text" value="CreditHour" size="13"><input type="text" value="GradePoint " size="12"><input type="text" value="Grade " size="5"><br/>
<input type="text" value="1 " size="1"><input type="text" name="coursename1" value=" " size="30"><input type="text" name="coursecode1" value=" " size="12"><input type="text" name="Marks1" value=" " size="5"/><input type="text" name="credit1" value=" " size="13"><input type="text" name="gradepoint1" size="12"><input type="text" name="grade1" size="5"><br/>
<input type="text" value="2 " size="1"><input type="text" name="coursename2" value=" " size="30"><input type="text" name="coursecode2" value=" " size="12"><input type="text" name="Marks2" value=" " size="5"/><input type="text" name="credit2" value=" " size="13"><input type="text" name="gradepoint2" size="12"><input type="text" name="grade2" size="5"><br/>
<input type="text" value="3 " size="1"><input type="text" name="coursename3" value=" " size="30"><input type="text" name="coursecode3" value=" " size="12"><input type="text" name="Marks3" value=" " size="5"/><input type="text" name="credit3" value=" " size="13"><input type="text" name="gradepoint3" size="12"><input type="text" name="grade3" size="5"><br/>
<input type="text" value="4 " size="1"><input type="text" name="coursename4" value=" " size="30"><input type="text" name="coursecode4" value=" " size="12"><input type="text" name="Marks4" value=" " size="5"/><input type="text" name="credit4" value=" " size="13"><input type="text" name="gradepoint4" size="12"><input type="text" name="grade4" size="5"><br/>

<br>
<input type="button" name="calculate" value="Calculate"/><input type="reset" value="Reset"><br>
<br>
Overall Grade Points:</td><input type="text" name="overall" size="10"/></td>
<br/>
GPA:</td><input type="text" name="gpa" size="10"/></td>

<br>
<br>



</form>
</BODY>
</HTML>

sumber aku dapat dari google je.. tu terabur sgtOK

soalan aku..
1. mcm mana nak resetkan part A and B sekali?
2. coding sepah giler, ada idea tak nak guna select case mcm mana? sbb skrg aku guna if_else je.. jadi formula berulang2..
3. untuk coursename dan code, mcm mana nak kasi drop list ?

aku baru je belajar ni.. pening jugak ni.. klu ada sapa2 yg ada pengalaman dalam ni.. boleh la bantu aku.. ^^
[Image: 1669544285.png]
Reply
14-02-2013, 04:24 PM, (This post was last modified: 14-02-2013, 04:28 PM by lamki.)
Post: #2
RE: [HELP] VBscript in html (kira markah gpa)
1 . Tekan button reset

3 .
Code:
<select>
<option>pilihan 1</option>
<option>pilihan 2</option>
<option>pilihan 3</option>
</select>

btw, yg CourseName, Mark, GradePoint to buat la readonly, sbb tu title je...
and, kalau da input mark, aku rasa xyah input da grade ngan grade point tu, buat auto

Fuck That Shit
Revenge 101 :
Spoiler:

1.Pee in plate
2.Freeze the pee(in 1.)
3.Slide frozen 'pee disc' under the victim's door(room or house, any will do)
4.The pee disc will now melt.
5.???
6.Profit

Hmm
Reply
14-02-2013, 04:36 PM,
Post: #3
RE: [HELP] VBscript in html (kira markah gpa)
(14-02-2013, 04:24 PM)lamki Wrote: 1 . Tekan button reset

3 .
Code:
<select>
<option>pilihan 1</option>
<option>pilihan 2</option>
<option>pilihan 3</option>
</select>

btw, yg CourseName, Mark, GradePoint to buat la readonly, sbb tu title je...
and, kalau da input mark, aku rasa xyah input da grade ngan grade point tu, buat auto

Fuck That Shit

yang Reset button tu hanya part B je direset.. perasan tak part A yg kena fill up detail tu.. nak reset tu sekali.. aku pening jugak..

yang coursename/mark tukar text=readonly ? OK.
input grade/grade point tu macam mana nak buat auto? minta pencerahan sikit lagi. aku tak paham sgt ni. OK
[Image: 1669544285.png]
Reply
14-02-2013, 04:45 PM,
Post: #4
RE: [HELP] VBscript in html (kira markah gpa)
(14-02-2013, 04:36 PM)blackoni2 Wrote: yang Reset button tu hanya part B je direset.. perasan tak part A yg kena fill up detail tu.. nak reset tu sekali.. aku pening jugak..
pindahkan code ni kat letak kat atas :
Code:
<form name = "form1" method = "post">

(14-02-2013, 04:36 PM)blackoni2 Wrote: input grade/grade point tu macam mana nak buat auto? minta pencerahan sikit lagi. aku tak paham sgt ni. OK

guna javascript, pakai onChange, bila user input grade dia terus isi colum tu,
cadangan je, cara lain pon boleh
Revenge 101 :
Spoiler:

1.Pee in plate
2.Freeze the pee(in 1.)
3.Slide frozen 'pee disc' under the victim's door(room or house, any will do)
4.The pee disc will now melt.
5.???
6.Profit

Hmm
Reply
14-02-2013, 04:50 PM,
Post: #5
RE: [HELP] VBscript in html (kira markah gpa)
(14-02-2013, 04:36 PM)blackoni2 Wrote: input grade/grade point tu macam mana nak buat auto? minta pencerahan sikit lagi. aku tak paham sgt ni. OK

guna javascript, pakai onChange, bila user input grade dia terus isi colum tu,
cadangan je, cara lain pon boleh
[/quote]

ada tak cara untuk guna vbscript ? sbb task aku kna calculate pakai vbscript. klu ada link/ebook/tutorial, boleh la share ye ~
[Image: 1669544285.png]
Reply
24-05-2013, 06:01 PM,
Post: #6
RE: [HELP] VBscript in html (kira markah gpa)
nak snang asing kan je html ngan js ko..
xde la srabut2 sgt..
Reply
24-05-2013, 08:29 PM,
Post: #7
RE: [HELP] VBscript in html (kira markah gpa)
(14-02-2013, 04:13 PM)blackoni2 Wrote: salam geng, aku ada buat 1 assignment ni.. tadi aku stuck sikit lah.. dah mati akal dah.. ada sapa2 leh tlg tak ?

Code:
<html>
<head>

Academic Performance Form
<p>
Part A
<p>


Name:<input type="text" name="name" size="70"/><br>
Student ID:<input type="text" name="student" size="70"/><br>
I.C/Passport Number:<input type="text" name="ic" size="70"/><br>
Race:<input type="text" name="race" size="70"/><br>
Religion:<input type="text" name="religion" size="70"/><br>
Nationality:<input type="text" name="nationality" size="70"/><br>
Gender (Male/Female):<input type="text" name="gender" size="70"/><br>
Home Address:<input type="text" name="address" size="70"/><br>

             <input type="text" name="address" size="70"/><br>

             <input type="text" name="address" size="70"/><br>

Mobile Number:<input type="text" name="address" size="70"/><br>
Email Address:<input type="text" name="email" size="70"/><br>
Faculty:<input type="text" name="faculty" size="70"/><br>
Program (e.g. Bachelor of Arts):<input type="text" name="program" size="70"/><br>
Study Mode ( Full/Part time):<input type="text" name="study" size="70"/><br>
You are in Semester:<input type="text" name="semester" size="70"/><br>
Semester ( Jan/May/Sept) & Year:<input type="text" name="semester" size="70"/><br>


</body>
</html>


<HTML>
<HEAD>
<TITLE>Grade Calculator - VBScript</TITLE>

<br>
Part B
</b>
<p>



<script language="vbscript">
sub calculate_onclick



if len(form1.coursecode1.value)<2 or IsNumeric(form1.coursecode1.value)then
   msgbox("Incorrect data entered or field is blank for coursecode")
   form.txtName.focus
   form.txtName.select
end if
  
if len(form1.coursecode2.value)<2 or IsNumeric(form1.coursecode2.value)then
   msgbox("Incorrect data entered or field is blank for coursecode")
   form.txtName.focus
   form.txtName.select
end if
  
if len(form1.coursecode3.value)<2 or IsNumeric(form1.coursecode3.value)then
   msgbox("Incorrect data entered or field is blank for coursecode")
   form.txtName.focus
   form.txtName.select
end if
  
if len(form1.coursecode4.value)<2 or IsNumeric(form1.coursecode4.value)then
   msgbox("Incorrect data entered or field is blank for coursecode")
   form.txtName.focus
   form.txtName.select
end if


  



if len(form1.coursename1.value)<2 or IsNumeric(form1.coursename1.value)then
   msgbox("Incorrect data entered or field is blank for coursename")
   form.txtName.focus
   form.txtName.select
end if

if len(form1.coursename2.value)<2 or IsNumeric(form1.coursename2.value)then
   msgbox("Incorrect data entered or field is blank for coursename")
   form.txtName.focus
   form.txtName.select
end if

if len(form1.coursename3.value)<2 or IsNumeric(form1.coursename3.value)then
   msgbox("Incorrect data entered or field is blank for coursename")
   form.txtName.focus
   form.txtName.select
end if

if len(form1.coursename4.value)<2 or IsNumeric(form1.coursename4.value)then
   msgbox("Incorrect data entered or field is blank for coursename")
   form.txtName.focus
   form.txtName.select
end if




if isNumeric(form1.Marks1.value)then
   Marks1=CInt(form1.Marks1.value)
else
   myMessage="Incorrect data entered or field is blank for Mark"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.Marks2.value)then
   Marks2=CInt(form1.Marks2.value)
else
   myMessage="Incorrect data entered or field is blank for Mark"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.Marks3.value)then
   Marks3=CInt(form1.Marks3.value)
else
   myMessage="Incorrect data entered or field is blank for Mark"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.Marks4.value)then
   Marks4=CInt(form1.Marks4.value)
else
   myMessage="Incorrect data entered or field is blank for Mark"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if




if isNumeric(form1.credit1.value)then
   credit1=CInt(form1.credit1.value)
else
   myMessage="Incorrect data entered or field is blank for credit hour"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.credit2.value)then
   credit2=CInt(form1.credit2.value)
else
   myMessage="Incorrect data entered or field is blank for credit hour"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.credit3.value)then
  credit3=CInt(form1.credit3.value)
else
   myMessage="Incorrect data entered or field is blank for credit hour"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if
if isNumeric(form1.credit4.value)then
   credit4=CInt(form1.credit4.value)
else
   myMessage="Incorrect data entered or field is blank for credit hour"
   msgBox myMessage, 48, "Incorrect data"
   form.txtName.focus
   form.txtName.select
end if



if marks1 >= 80  then
   form1.gradepoint1.value = "4.00"
elseif marks1 >= 75 and marks1 <= 79 then
   form1.gradepoint1.value = "3.67"
elseif marks1 >= 70 and marks1 <= 74 then
   form1.gradepoint1.value = "3.33"
elseif marks1 >= 65 and marks1 <= 69 then
   form1.gradepoint1.value = "3.00"
elseif marks1 >= 60 and marks1 <= 64 then
   form1.gradepoint1.value = "2.67"
elseif marks1 >= 55 and marks1 <= 59 then
   form1.gradepoint1.value = "2.33"
elseif marks1 >= 50 and marks1 <= 54 then
   form1.gradepoint1.value = "2.00"
elseif marks1 >= 45 and marks1 <= 49 then
   form1.gradepoint1.value = "1.67"
elseif marks1 >= 40 and marks1 <= 44 then
   form1.gradepoint1.value = "1.33"
elseif marks1 >= 35 and marks1 <= 39 then
   form1.gradepoint1.value = "1.00"
elseif marks1 >= 00 and marks1 <= 34 then  
   form1.gradepoint1.value = "0.00"
end if

if marks2 >= 80  then
   form1.gradepoint2.value = "4.00"
elseif marks2 >= 75 and marks2 <= 79 then
   form1.gradepoint2.value = "3.67"
elseif marks2 >= 70 and marks2 <= 74 then
   form1.gradepoint2.value = "3.33"
elseif marks2 >= 65 and marks2 <= 69 then
   form1.gradepoint2.value = "3.00"
elseif marks2 >= 60 and marks2 <= 64 then
   form1.gradepoint2.value = "2.67"
elseif marks2 >= 55 and marks2 <= 59 then
   form1.gradepoint2.value = "2.33"
elseif marks2 >= 50 and marks2 <= 54 then
   form1.gradepoint2.value = "2.00"
elseif marks2 >= 45 and marks2 <= 49 then
   form1.gradepoint2.value = "1.67"
elseif marks2 >= 40 and marks2 <= 44 then
   form1.gradepoint2.value = "1.33"
elseif marks2 >= 35 and marks2 <= 39 then
   form1.gradepoint2.value = "1.00"
elseif marks2 >= 00 and marks2 <= 34 then  
   form1.gradepoint2.value = "0.00"
end if

if marks3 >= 80  then
   form1.gradepoint3.value = "4.00"
elseif marks3 >= 75 and marks3 <= 79 then
   form1.gradepoint3.value = "3.67"
elseif marks3 >= 70 and marks3 <= 74 then
   form1.gradepoint3.value = "3.33"
elseif marks3 >= 65 and marks3 <= 69 then
   form1.gradepoint3.value = "3.00"
elseif marks3 >= 60 and marks3 <= 64 then
   form1.gradepoint3.value = "2.67"
elseif marks3 >= 55 and marks3 <= 59 then
   form1.gradepoint3.value = "2.33"
elseif marks3 >= 50 and marks3 <= 54 then
   form1.gradepoint3.value = "2.00"
elseif marks3 >= 45 and marks3 <= 49 then
   form1.gradepoint3.value = "1.67"
elseif marks3 >= 40 and marks3 <= 44 then
   form1.gradepoint3.value = "1.33"
elseif marks3 >= 35 and marks3 <= 39 then
   form1.gradepoint3.value = "1.00"
elseif marks3 >= 00 and marks3 <= 34 then  
   form1.gradepoint3.value = "0.00"
end if

if marks4 >= 80  then
   form1.gradepoint4.value = "4.00"
elseif marks4 >= 75 and marks4 <= 79 then
   form1.gradepoint4.value = "3.67"
elseif marks4 >= 70 and marks4 <= 74 then
   form1.gradepoint4.value = "3.33"
elseif marks4 >= 65 and marks4 <= 69 then
   form1.gradepoint4.value = "3.00"
elseif marks4 >= 60 and marks4 <= 64 then
   form1.gradepoint4.value = "2.67"
elseif marks4 >= 55 and marks4 <= 59 then
   form1.gradepoint4.value = "2.33"
elseif marks4 >= 50 and marks4 <= 54 then
   form1.gradepoint4.value = "2.00"
elseif marks4 >= 45 and marks4 <= 49 then
   form1.gradepoint4.value = "1.67"
elseif marks4 >= 40 and marks4 <= 44 then
   form1.gradepoint4.value = "1.33"
elseif marks4 >= 35 and marks4 <= 39 then
   form1.gradepoint4.value = "1.00"
elseif marks4 >= 00 and marks4 <= 34 then  
   form1.gradepoint4.value = "0.00"
end if



if marks1>= 80  then
   form1.grade1.value = "A"
elseif marks1 >= 75 and marks1 <= 79 then
   form1.grade1.value = "A-"
elseif marks1 >= 70 and marks1 <= 74 then
   form1.grade1.value = "B+"
elseif marks1 >= 65 and marks1 <= 69 then
   form1.grade1.value = "B"
elseif marks1 >= 60 and marks1 <= 64 then
   form1.grade1.value = "B-"
elseif marks1 >= 55 and marks1 <= 59 then
   form1.grade1.value = "C+"
elseif marks1 >= 50 and marks1 <= 54 then
   form1.grade1.value = "C"
elseif marks1 >= 45 and marks1 <= 49 then
   form1.grade1.value = "C-"
elseif marks1 >= 40 and marks1 <= 44 then
   form1.grade1.value = "D+"
elseif marks1 >= 35 and marks1 <= 39 then
   form1.grade1.value = "D"
elseif marks1 >= 00 and marks1 <= 34 then  
   form1.grade1.value = "F"
end if

if marks2>= 80  then
   form1.grade2.value = "A"
elseif marks2 >= 75 and marks2 <= 79 then
   form1.grade2.value = "A-"
elseif marks2 >= 70 and marks2 <= 74 then
   form1.grade2.value = "B+"
elseif marks2 >= 65 and marks2 <= 69 then
   form1.grade2.value = "B"
elseif marks2 >= 60 and marks2 <= 64 then
   form1.grade2.value = "B-"
elseif marks2 >= 55 and marks2 <= 59 then
   form1.grade2.value = "C+"
elseif marks2 >= 50 and marks2 <= 54 then
   form1.grade2.value = "C"
elseif marks2 >= 45 and marks2 <= 49 then
   form1.grade2.value = "C-"
elseif marks2 >= 40 and marks2 <= 44 then
   form1.grade2.value = "D+"
elseif marks2 >= 35 and marks2 <= 39 then
   form1.grade2.value = "D"
elseif marks2 >= 00 and marks2 <= 34 then  
   form1.grade2.value = "F"
end if

if marks3>= 80  then
   form1.grade3.value = "A"
elseif marks3 >= 75 and marks3 <= 79 then
   form1.grade3.value = "A-"
elseif marks3 >= 70 and marks3 <= 74 then
   form1.grade3.value = "B+"
elseif marks3 >= 65 and marks3 <= 69 then
   form1.grade3.value = "B"
elseif marks3 >= 60 and marks3 <= 64 then
   form1.grade3.value = "B-"
elseif marks3 >= 55 and marks3 <= 59 then
   form1.grade3.value = "C+"
elseif marks3 >= 50 and marks3 <= 54 then
   form1.grade3.value = "C"
elseif marks3 >= 45 and marks3 <= 49 then
   form1.grade3.value = "C-"
elseif marks3 >= 40 and marks3 <= 44 then
   form1.grade3.value = "D+"
elseif marks3 >= 35 and marks3 <= 39 then
   form1.grade3.value = "D"
elseif marks3 >= 00 and marks3 <= 34 then  
   form1.grade3.value = "F"
end if

if marks4>= 80  then
   form1.grade4.value = "A"
elseif marks4 >= 75 and marks4 <= 79 then
   form1.grade4.value = "A-"
elseif marks4 >= 70 and marks4 <= 74 then
   form1.grade4.value = "B+"
elseif marks4 >= 65 and marks4 <= 69 then
   form1.grade4.value = "B"
elseif marks4 >= 60 and marks4 <= 64 then
   form1.grade4.value = "B-"
elseif marks4 >= 55 and marks4 <= 59 then
   form1.grade4.value = "C+"
elseif marks4 >= 50 and marks4 <= 54 then
   form1.grade4.value = "C"
elseif marks4 >= 45 and marks4 <= 49 then
   form1.grade4.value = "C-"
elseif marks4 >= 40 and marks4 <= 44 then
   form1.grade4.value = "D+"
elseif marks4 >= 35 and marks4 <= 39 then
   form1.grade4.value = "D"
elseif marks4 >= 00 and marks4 <= 34 then  
   form1.grade4.value = "F"
end if




overall=(form1.gradepoint1.value*credit1)+(form1.gradepoint2.value*credit2)+(form1.gradepoint3.value*credit3)+(form1.gradepoint4.value*credit4)
overall=round(overall,2)
form1.overall.value=overall

gpa=form1.overall.value/(credit1+credit2+credit3+credit4)
gpa=round(gpa,2)
form1.gpa.value=gpa


end sub
</script>

</HEAD>

<BODY BGCOLOR="#FFFFFF" TEXT="000000" LINK="#FF0000"
<H2>Grade Point Average (GPA) Calculator</H2>
<form name = "form1" method = "post">


<input type="text" value="Num" size="1"><input type="text" value="CourseName " size="30"><input type="text" value="CourseCode " size="12"><input type="text" name="Marks" value="Mark" size="5"/><input type="text" value="CreditHour" size="13"><input type="text" value="GradePoint " size="12"><input type="text" value="Grade " size="5"><br/>
<input type="text" value="1 " size="1"><input type="text" name="coursename1" value=" " size="30"><input type="text" name="coursecode1" value=" " size="12"><input type="text" name="Marks1" value=" " size="5"/><input type="text" name="credit1" value=" " size="13"><input type="text" name="gradepoint1" size="12"><input type="text" name="grade1" size="5"><br/>
<input type="text" value="2 " size="1"><input type="text" name="coursename2" value=" " size="30"><input type="text" name="coursecode2" value=" " size="12"><input type="text" name="Marks2" value=" " size="5"/><input type="text" name="credit2" value=" " size="13"><input type="text" name="gradepoint2" size="12"><input type="text" name="grade2" size="5"><br/>
<input type="text" value="3 " size="1"><input type="text" name="coursename3" value=" " size="30"><input type="text" name="coursecode3" value=" " size="12"><input type="text" name="Marks3" value=" " size="5"/><input type="text" name="credit3" value=" " size="13"><input type="text" name="gradepoint3" size="12"><input type="text" name="grade3" size="5"><br/>
<input type="text" value="4 " size="1"><input type="text" name="coursename4" value=" " size="30"><input type="text" name="coursecode4" value=" " size="12"><input type="text" name="Marks4" value=" " size="5"/><input type="text" name="credit4" value=" " size="13"><input type="text" name="gradepoint4" size="12"><input type="text" name="grade4" size="5"><br/>

<br>
<input type="button" name="calculate" value="Calculate"/><input type="reset" value="Reset"><br>
<br>
Overall Grade Points:</td><input type="text" name="overall" size="10"/></td>
<br/>
GPA:</td><input type="text" name="gpa" size="10"/></td>

<br>
<br>



</form>
</BODY>
</HTML>

sumber aku dapat dari google je.. tu terabur sgtOK

soalan aku..
1. mcm mana nak resetkan part A and B sekali?
2. coding sepah giler, ada idea tak nak guna select case mcm mana? sbb skrg aku guna if_else je.. jadi formula berulang2..
3. untuk coursename dan code, mcm mana nak kasi drop list ?

aku baru je belajar ni.. pening jugak ni.. klu ada sapa2 yg ada pengalaman dalam ni.. boleh la bantu aku.. ^^

perghh.. panjang betul coding kau ni.. pasal tak guna loop je. sebab lagi cantik flow kalau guna loop dekat situasi kau ni.. Smile
=Z
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Safari 7 Tidak Support HTML 5 Web Socket? biborn 0 361 26-10-2013, 05:56 PM
Last Post: biborn
  [HTML] Help Ujang 6 772 22-02-2013, 10:21 PM
Last Post: PistolCodez
  [ASK] encrypte html anthrax 5 825 11-01-2013, 04:59 PM
Last Post: anthrax
  [HTML] 404 No Signal sykess 1 521 04-12-2012, 03:23 PM
Last Post: AceyrafRoshlanz
  TBD Clock [Basic HTML] sykess 8 1,074 26-08-2012, 11:42 AM
Last Post: darknite
  [help html]hyperlink to another page pron3t 8 872 19-08-2012, 02:08 PM
Last Post: PistolCodez
  Mintak tolong pasal jQuery/html Mojo 2 988 13-05-2012, 01:45 AM
Last Post: Mojo
  [help] tolong fix bug kat webpage html aku pron3t 8 1,233 12-04-2012, 03:08 PM
Last Post: sil
  <ask pasal html>nk buat label select tp x jd pron3t 11 2,612 09-02-2012, 03:48 PM
Last Post: cecikut
  [tolong]html connect ms access using javascript jamil992 4 990 01-02-2012, 11:12 AM
Last Post: paley

Forum Jump: