JSrcipt Tutorial
Lesson:
6
Sample Description:
A test!
User Level:
1.New
2.Casual
3.Accomplished
4.Expert
|
About Lesson 6:
Did you ever think about
A Test!
This sample showes you how to make an online
examination. Just be careful in a new condition phrase
that is named 'switch'.
This helps you to reduce the use of 'If'
phraces, and is much more simple too.
Can you say that, what the default phrase do?
**************************************
It think that the answer is 'C'.
Or 'c' in some cases!
What you think so...?
|
|
Test the sample!
|
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<SCRIPT language=javascript>
<!--
function salaam5() {
var aa
aa=text4.value;
switch (aa){
case 'a':
window.alert ('Wrong!')
break
case 'b':
window.alert ('Wrong!')
break
case 'c':
window.alert ('Right!')
break
case 'C':
window.alert ('Right!')
break
case 'd':
window.alert ('Wrong!')
break
default:
window.alert ('Select one of the a,b,c or d')
}
}
//-->
</SCRIPT>
<BODY bgcolor=white>
Q1. ..... I help you?
a) Can
b) Would
c) May
d) Will
<INPUT id=button1 name=button1 type=button value="Check it!"
LANGUAGE=javascript onclick="return salaam5()">
<INPUT id=text4 name=text4 >
</BODY>
</HTML>
|
|