Skip to content

Commit

Permalink
Changed javascript function in gpa.js and added that function into jo…
Browse files Browse the repository at this point in the history
…bs.html
  • Loading branch information
unknown authored and unknown committed Feb 3, 2014
1 parent 5027506 commit c16e6b2
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 16 deletions.
46 changes: 37 additions & 9 deletions gpa.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,43 @@
function calculateGPA(){
var it_3153 = document.getElementById("3153").value;
var it_3503 = document.getElementById("3503").value;
var it_4153 = document.getElementById("4153").value;
var it_3883 = document.getElementById("3883").value;
var it_4323 = document.getElementById("4323").value;
var grades = new Array();

grades[0] = document.getElementById("3153").value; //it_3153
grades[1] = document.getElementById("3503").value; //it_3503
grades[2] = document.getElementById("4153").value; //it_4153
grades[3] = document.getElementById("3883").value; //it_3883
grades[4] = document.getElementById("4323").value; //it_4323

var gpa = (it_3153+it_3503+it_4153+it_3883+it_4323)/5;
for(var i = 0; i<grades.length;i++){
if(grades[i] === 'A' || grades[i] === 'a'){
grades[i] = 4;
} else if(grades[i] === 'B' || grades[i] === 'b'){
grades[i] = 3;
} else if(grades[i] === 'C' || grades[i] === 'c'){
grades[i] = 2;
} else if(grades[i] === 'D' || grades[i] === 'd'){
grades[i] = 1;
} else {
grades[i] = 0;
}
}

var gpa = 0;

for(var i = 0; i<grades.length;i++){
gpa+=grades[i];
}

gpa /= 5;

var div = document.getElementByID('content');

if (gpa < 3.5){
$("body").append("<p>We're sorry. Please try again next year!</p>");
//$("body").append("<p>We're sorry. Please try again next year!</p>");
var content = document.createTextNode("<p>We're sorry. Please try again next year!</p>");
div.appendChild(content);
} else {
$("body").append("<p>Congratulations! Please send your resume to <a href=\"mailto:[email protected]\">Curtis White</a></p>");
//$("body").append("<p>Congratulations! Please send your resume to <a href=\"mailto:[email protected]\">Curtis White</a></p>");
var content = document.createTextNode("<p>Congratulations! Please send your resume to <a href=\"mailto:[email protected]\">Curtis White</a></p>");
div.appendChild(content);
}
}
}
60 changes: 53 additions & 7 deletions jobs.htm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,51 @@ <h1>
</div>

<div class="content">
<script src="gpa.js"></script>
<script>
function calculateGPA(){
var grades = new Array();

grades[0] = document.getElementById("3153").value; //it_3153
grades[1] = document.getElementById("3503").value; //it_3503
grades[2] = document.getElementById("4153").value; //it_4153
grades[3] = document.getElementById("3883").value; //it_3883
grades[4] = document.getElementById("4323").value; //it_4323

for(var i = 0; i<grades.length;i++){
if(grades[i] === 'A' || grades[i] === 'a'){
grades[i] = 4;
} else if(grades[i] === 'B' || grades[i] === 'b'){
grades[i] = 3;
} else if(grades[i] === 'C' || grades[i] === 'c'){
grades[i] = 2;
} else if(grades[i] === 'D' || grades[i] === 'd'){
grades[i] = 1;
} else {
grades[i] = 0;
}
}

var gpa = 0;

for(var i = 0; i<grades.length;i++){
gpa+=grades[i];
}

gpa /= 5;

var div = document.getElementByID('content');

if (gpa < 3.5){
//$("body").append("<p>We're sorry. Please try again next year!</p>");
var content = document.createTextNode("<p>We're sorry. Please try again next year!</p>");
div.appendChild(content);
} else {
//$("body").append("<p>Congratulations! Please send your resume to <a href=\"mailto:[email protected]\">Curtis White</a></p>");
var content = document.createTextNode("<p>Congratulations! Please send your resume to <a href=\"mailto:[email protected]\">Curtis White</a></p>");
div.appendChild(content);
}
}
</script>
<h2 align="center">For more information please fill out the form below and click submit</h2>

<form action="">
Expand All @@ -45,40 +89,42 @@ <h2 align="center">For more information please fill out the form below and click
<input type="text" name="lname" size="30" />
</label>

<br />

<label>Please Enter your grade for IT 3153:
<input type="text" id="3153" name="IT_3153" size="30" />
<input type="text" id="3153" name="IT_3153" size="5" />
</label>

<br />

<br />

<label>Please Enter your grade for IT 3503:
<input type="text" id="3503" name="IT_3503" size="10" />
<input type="text" id="3503" name="IT_3503" size="5" />
</label>

<br />

<label>Please Enter your grade for IT 4153:
<input type="text" id="4153" name="IT_4153" size="75" />
<input type="text" id="4153" name="IT_4153" size="5" />
</label>

<br />

<label>Please Enter your grade for IT 3883:
<input type="text" id="3883" name="IT_3883" size="30" />
<input type="text" id="3883" name="IT_3883" size="5" />
</label>

<br />

<label>Please Enter your grade for IT 4323:
<input type="text" id="4323" name="IT_4323" size="30" />
<input type="text" id="4323" name="IT_4323" size="5" />
</label>

<br />

<p>
<input type="submit" value="Submit" />
<input type="submit" value="Submit" onclick="calculateGPA()"/>
<input type="reset" value="Clear form" />
</p>
</form>
Expand Down

0 comments on commit c16e6b2

Please sign in to comment.