Rolf's Calculator
Welcome to the definitive JavaScript 'pocket' calculator!
This applet illustrates several JavaScript features:
- the use of a client-side image map for the keypad
- the use of cookies (to store the calculator's memory)
- how to format numeric output (controlling the number of decimal places, which is quite a task
in JavaScript, and outputting in other bases such as hex and binary)
- launching new windows without a toolbar to simulate a floating palette
- how to prevent users from typing into output fields.
A fully featured scientific calculator is implemented, including trig functions and
logarithms, factorials, 12 levels of parentheses, logs to base 2 (one of my favourite
functions!), bitwise logical operators, hex, octal, binary and ascii display.
(Warning: you may occasionally notice strange results in the Windows version due to problems with its
floating point implementation.)
There are actually two separate
calculators with different keypad layouts, a scientific calculator and one for
logical operations. To switch from scientific to logical display press the 'HEX' key.
To switch back to scientific mode press the 'DEC' key twice (the first press
converts the displayed value from hex to decimal but leaves you in the hex calculator).
You should normally launch the calculator
so a window of the right size is created.
(If that doesn't work, try going straight to the calculator within this window.)
Please mail me with any comments or bug reports.
Rolf Howarth