JSrcipt Tutorial
Lesson:
1
Sample Description:
Increment!
User Level:
1.New
2.Casual
3.Accomplished
4.Expert
|
About Lesson 1:
The
Increment!
sample is a simple usage of
Client side script programing using JScript.
When you are clicking on the button the text box's
value will increse one unit.
The code
"aa=parseFloat(aa);"
changes the String to Float.
This is neccessary for the code
"aa=aa+1;". The code "text1.value"
meaning is: "The value of text1!"
Pay attention to the HTML source codes
that
are provided here.
|
|
Test the sample!
|
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<SCRIPT language=javascript>
<!--
var aa
function salaam() {
aa=text1.value;
aa=parseFloat(aa);
aa=aa+1;
text1.value=aa;
}
//-->
</SCRIPT>
<BODY bgcolor=white>
<INPUT id=button1 name=button1 type=button value=Button
LANGUAGE=javascript onclick="return salaam()">
<INPUT id=text1 name=text1 value=1>
</BODY>
</HTML>
|
|