|
|
 |
|
Behind the Curtain |
|
Where I might say a few words
from time to time to notify visitors of changes or additions.
Yeah, right.
Or maybe I will just comment on some current event.
A policy of an eye for an eye, will only lead to everyone being blind.
Pay no attention to that man behind the curtain. |
 |
|
Ü oz@threeclicks.com |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Contact Us | Search |
About Us
|
•
Java Script Calculator
|
Samples: Calculator
How Does This Sample Work?
The calculator is an HTML table containing button
controls. The buttons themselves are intrinsic
<INPUT> style buttons, not Microsoft®
ActiveX® controls. Microsoft® JScript® code is
attached to the OnClick event for these buttons.
The display is simply an intrinsic <INPUT>
style text box.
Notice the variable declared at the beginning of
the <SCRIPT> tag, outside of any procedure:
<SCRIPT LANGUAGE="JavaScript">
<!--
// Module-level variables
var FKeyPad = document.Keypad;
var Accum = 0; // Previous number (operand)
awaiting operation
var FlagNewNum = false; // Flag to indicate a new
number (operand) is being entered
var PendingOp = ""; // Pending operation
waiting for completion of second operand
. . . view source for the rest Ü
These are module-level variables that persist for
as long as the page is loaded. By contrast,
variables declared within a procedure cease to
exist as soon as the procedure exits. Thus,
module-level variables can be used to store values
that must persist between invocations of a
procedure. Module-level variables are also visible
to all procedures, and so are useful when multiple
procedures need to share values.
|
|
|
|
|
|