These sections are (for now)
just a collection of unrelated JavaScript
demos.
I started working on these back in the summer of 97'
when I discovered
gold mine,
and I used that to do the first three or four of the demos
that follow.
Later ones have been done basically when I had the need to
put together some JavaScript for some particular purpose.
Except where noted (below), these demos all work flawless with Netscape,
where the script engine is JavaScript, and with
Internet Explorer, where you get Microsoft's JScript™ counterpart...
that is, all except for
this wee glitch
(that only works with IE).
Last updated (this demo): 8/04/1997 17:21
Every time you Refresh or Reload this page the <form ...> object is reconstructed from scratch so re-clicking the button will simply copy the initial hard-wired prompt phrase into the window status line.
Last updated (this demo): 8/03/1997 21:55
Simply Refresh or Reload the page to see how a different time is rendered.
Last updated (this demo): 7/29/1997 12:42
Click the "Chose Again" button to make a different choice. Alternatively you can Refresh or Reload the page (although this appears not to work with IE for a reason that I have not yet determined).
Last updated (this demo): 8/10/1997 16:51
The centered title for this demo shows off a very nifty use for the "number . toString()" function that I found (on Microsoft's JScript™ and VBScript™ page) that will convert a date object into its fully-readable string form.
Simply Refresh or Reload the page to see how a different month/day/year is rendered. (nope! That doesn't work because the Var context is not retained... I'm gonna have to figure out a different way to do this!)
Last updated (this demo): before Thursday, June 18, 1998, 11:17:50 AM
It provides a <form ...> which has one input field, a related output field, and a Button object that makes the two correspond. The action associated with the button click encodes the string currently in the type-in field and displays the result in the associated output field. The later (for now) does let you type into it, but doing so has no meaning.
For this demo, the encoding does this: map all odd characters into the letter that comes before them in the alphabet, where odd refers to the ordinal position in the string where the characters appears. All even characters are mapped into the character that follows them, alphabetically. To make sure this all stays within the realm of ASCII (actually, charset=iso8859-1), the mapping leaves the space character alone.
This particular encoding has the useful characteristic that it is reversible by simply offsetting by one. That is, encode a normal word, capture the result, offset that by putting (e.g.) a space in the first character position, and finally re-encode that string. And voilà - you get back the phrase you started with (as long as you ignore the superfluous offset character).
Every time you Refresh or Reload this page the <form ...> object is reconstructed from scratch so if you do this you will lose the phrase that you may have wanted to encode.
Last updated (this demo): before Wednesday, June 17, 1998, 11:00:00 PM
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
. . .
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.
Click here for the full source, context, and credit for this
Sample.
If you Refresh or Reload, the calculator variables are reset to zero.
Last updated (this demo): before Thursday, June 18, 1998, 11:17:50 AM
It provides a <form ...> which has a dropdown list which contains a set of pre-determined choices and an initial default. There is also a Button object that reads the value associated with the DropDown list, and does a simple "translation" on it just to show, effectively, that we can have an arbitrary JavaScript function which can do this. What I really want to do with this button is to make it show you the picture, but I haven't fully worked out how to do that. The translation field does (for now) let you type into it, but doing so has no meaning.
The "View" button, above "works" in the sense that it gets you the picture, but it does so in the same window you were in, so you have to use "Back" to get back to where you were. It looks like when you get back, you've still got the one selected you had before, but I'm not sure if the full browser context remains in tact so that's not what I was after for Las Vegas!.
Meanwhile, try Go There to see what happens when I can have the HREF target be a direct call to javascript : view_DropDownSelectionPath(); - Yet you can click on a Direct Path to verify that if I give the link path directly (hard coded) that it does, actually work. But, of course, this has nothing to do with getting the path in conjunction with the DropDown list box.
Every time you Refresh or Reload this page the <form ...> object is reconstructed from scratch but - for a reason that I can't explain - it does not lose its context.
Last updated (this demo): before Wednesday, June 17, 1998, 11:00:00 PM
GoTo the eXcite Home Page and pick out a "Horoscope" ...
Last updated (this demo): 8/Jan/2002 15:44