Welcome to my Javascript page! This has only been around for a little while, so there isn't much here yet. Your browser needs to support at least Javascript 1.0 for most of it, but some parts need your browser to support Javascript 1.2. Click here to see what your browser supports.
Scripts that require your browser to support only minimal Javascript (NN2 or higher) have a
beside them.
beside them. Scripts that use Javascript 1.1 (NN3, IE4 or higher) are shown with a
.
A few of the scripts utilize Javascript 1.2, which was released with Netscape Communicator 4,
and have a
beside them.
This only works if your browser supports Javascript 1.2
I wrote a quiz engine for multiple choice quizzes.
Email me if you want to use it on your site customized with your own questions, etc.
Wheel of Fortune
I am working on a mini arcade-style game with layers, but it isn't quite presentable yet.
DateFormat is a set of JavaScript functions that allow you to "feed" DateFormat
a format code and a date object (such as
new Date() for the current date or
document.lastModified for the current pages last modified date). DateFormat
then parses the format code with the date object and returns a string representing the date in
the format that was specified. DateFormat is complex enough that it has its own page,
right here.
The code:
function randomBetween(low,high,rounded){ if(rounded) return Math.round((high - low) * Math.random() + 1); return ((high - low) * Math.random() + 1); };
Use:
randomBetween(low,high,rounded)
Where the random number is between low and high, and rounded is true or false, meaing whether or not the random number is a whole number (rounded).
Example:
<A HREF="javascript:alert(randomBetween(1,1000,true))">Display a random whole number between 1 and 1000</A>
Display a random whole number between 1 and 1000
The code:
function numberEnding(num){ if(num >= 4 && num <= 20) { return "th"; } lastDigit = num.toString().charAt(num.toString().length-1); switch(lastDigit) { case "1": return "st"; case "2": return "nd"; case "3": return "rd"; case "0": return "th"; } return "th"; }
Use:
numberEnding(number)
Where number is the number to find an ending for.
Example:
<SCRIPT> function alertEnding(number){ alert(number + numberEnding(number)); } </SCRIPT> <A HREF="javascript:alertEnding(prompt('Enter any whole number.',''))">Click for example</A>
Click for example
This form uses mailto, so it may not work with IE!
I have a model rocket page too!