JSrcipt Tutorial
Lesson:
8
Sample Description:
Loops!
User Level:
1.New
2.Casual
3.Accomplished
4.Expert
|
About Lesson 8:
The
Loops!
sample is a simple usage of
Loops!!!
When you need to do an operation up to
when a condition fails, you must use loops.
So make yourself ready to count up to 1000!
I think that you are so good in JavaScript now, that
you can found out, how to use loops yourself.
Pay attention again to the phrase 'bb()'.
This is the name of an extra function that
is useful for you to know, how to call
a function from another function or any other
locations.
|
|
Test the sample!
|
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<SCRIPT language=javascript>
<!--
function salaam7() {
aa=0;
while (aa < 1000){
aa=aa+1;
text7.value=aa;
}
one.innerHTML= '<b>' + aa + '</b>'
bb();
}
function bb(){
text7.value='Job Complete!';
}
//-->
</SCRIPT>
<BODY bgcolor=white>
<P>
<p id="one">I will count up to 1000?!</p>
<INPUT id=button3 name=button3 type=button value=Start? LANGUAGE=javascript onclick="return salaam7()">
<INPUT id=text7 name=text7></P>
</BODY>
</HTML>
|
|
|
|
|