Practical exercise eleven.

Simple if then else example.


This script illustrates the use of a binary decision control structure.
function test(theparam)
    {
       if (theparam >= 50)

           {document.form1.Outputwindow.value =" you got a pass" }
        else
           {
            alert("The result was a fail","")

            document.form1.Outputwindow.value =" you need  " + ( 50 -theparam)  +
            " more marks"

            }// end of the decision
    }// end of the function

Q1. Copy and modify the script to produce a result of "Credit " for marks over 75 and "pass" for marks between 50 and 75 inclusive.

result < 50 -->fail
result >= 50  &  result <=75  --> pass
result >75 credit



Type a test mark here: 

Check the test mark to see if its a pass.