hi all,
i was doing this coding and i get an error but i dont know what my error is could you please help me
thanks in advance

<html>
<head> <title> Student Final Results </title>

<style>


Inline Code Example Here`Inline Code Example Here`
    background: #f3f3f3 url('22.gif');
}
</style>


<script type="text/javascript">

function student()
{ 
var name = document.getElementById("name").value;
var number = parseInt(document.getElementById("number").value);

var pr1 = parseInt(document.getElementById("pr1").value);
var pr2 = parseInt(document.getElementById("pr2").value);
var cr1 =  parseInt(document.getElementById("cr1").value);

var op1 = parseInt(document.getElementById("op1").value);
var op2 = parseInt(document.getElementById("op2").value);
var cr2 =  parseInt(document.getElementById("cr2").value);

var da1 = parseInt(document.getElementById("da1").value);
var da2 = parseInt(document.getElementById("da2").value);
var cr3 =  parseInt(document.getElementById("cr3").value);

var prResult = getResult (pr1, pr2);
var opResult = getResult (op1, op2);
var daResult = getResult (da1, da2);

var gpa = ((((pr1 + pr2 )*cr1) + ((op1 + op2)*cr2)) + ((da1 + da2)*cr3)/ (cr1+cr2+cr3));

var output = "Dear student " + name + " number " + number ;

var programing = "\n \n programing 1 Result is: " + prResult;

var OperatingSystems = "\n \n Operating Systems Result is: " + opResult ;

var DataStructure = "\n \n Data Structures Result is: " + daResult ;

var date = "\n \n this Report is created on : " + date();

document.getElementById("result").value = output + programing + OperatingSystems + DataStructure
}

function getResult(exam1, exam2)
{
r = exam1 + exam2;
var degree = "";
if(r >= 90)
{
 degree = "excellent"
} 
else if(r >= 80)
{
degree = "very good"
}

else if(r >= 70)
{
degree = "good"
}

else if(r >= 60)
{
degree = "pass"
}

else
{
degree = "fall";
}

return degree;
}



</script>
</head>


<body >
<form id="myForm">

<p> <font face="verdana" size= "5" color="green"> <b> Student Final Results </b> </font> </p>

<label> Student's Name: </label> <input type=”text” id="name"  size=”6”/>
<label> Student's Number: </label> <input type=”text” id="number"  size=”6”/>
 <br><br>

<label> programming 1 </label>
<br><br>

<label> Mid-term Exam: </label> <input type=”text” id="pr1"  size=”4”/>
<label> Final Exam: </label> <input type=”text” id="pr2"  size=”4”/> 
<label> Credits </label> <input type=”text” id="cr1"  size=”4”/>
<br><br>

<label> Operating Systems </label>
<br><br>
<label> Mid-term Exam: </label> <input type=”text” id="op1"  size=”4”/> 
<label> Final Exam: </label> <input type=”text” id="op2"  size=”4”/> 
<label> Credits </label> <input type=”text” id="cr2"  size=”4”/>
<br><br>

<label> Data Structures </label>
<br><br>

<label> Mid-term Exam: </label> <input type=”text” id="da1"  size=”4”/> 
<label> Final Exam: </label><input type=”text” id="da2"  size=”4”/> 
<label> Credits </label> <input type=”text” id="cr3"  size=”4”/>
<br><br>

<input type="button" onclick = "getResult(exam1, exam2)" value = "Get Result"/> 
<input type="reset" value="clear All" />
<br><br>

<textarea id="result"  cols=80 rows=15>  

First of all, please do indent your code when post it here. It is very difficult for us to read.
Then, the code is not completed.
1. textarea, form, body, html missing corresponding closing tag.
2. Then, the form did not having the action to where it will post the data. If there is no need to post the data, then there is no need for the form also.
3. Next will be the code <input type="button" onclick = "getResult(exam1, exam2)" value = "Get Result"/> where the exam1,exam2 is not defined.

here is my closing tags i just missed them before
</textarea>
</form>
</body>
</html>

i want the calculation to appear in the "onclick" so i passed getResult(exam1, exam2)" from the function above where i defined exam1 and exam 2

what im trying to do is to have the student and getResult functions to appear after calculating in the onclick input

thanks again

still couldnt sort it out, please can i get some help thanks

What is your field for exam1,exam2?

i assigned them to R, and then declare degree so now the exam one and exam 2 will be assigned to r going through the if else .

am i missing anything ?

thanks

I meant: what is the html field of the exam1 and exam2.....which input(with which id) is containing the value of exam1 and exam2?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.