|
<html>
<head>
<script language = javascript>
var obj =
{
i: 0, // value of variable
add: function () // Function call, increase variable value by 1
{
this.i = this.i + 1;
alert ("the value of i is:" + this.i);
}
The
}
</ script>
</ head>
<body>
<input type = button onclick = "obj.add ();" value = "Add 1 to variable i and display">
</ body>
</ html> |
|