Joseph K. Myers
Thursday, December 29, 2005

High Performance JavaScript

Web Cipher 2
Web Cipher is a client-side, cryptographically secure document encryption technology. It allows even an inexperienced web author to establish virtually uncrackable safety measures on confidential data. Web Cipher is also fast, substantially overcoming the problem of speed in browser-based cryptology. It averages almost 15K per second in real-world tests on an iMac 333 MHz computer, much faster than similar utilities.

The purpose of Web Cipher 2 is to provide SSL-level encryption and data security for free without the need for SSL certificates or the associated costs.

JavaScript Query String Parser
In this article you'll learn how to obtain and use the data from the query string portion of the URL by using a JavaScript query string parser. Without a JavaScript query string parser, the query string data is accessible only to CGI scripts. Thus, this script is especially useful for people whose Web sites are served by free hosting providers. For most of these millions of people, there's no access to custom CGI capability, so a JavaScript query string parser is the only way to make multifunction Web pages.
JavaScript and HTML Tricks
Here are some of my favorite JavaScript and HTML tricks. There are a wide variety of options: from storing and using hidden data to making HTML forms and lists look great. Each topic has a brief introduction showing you how it will improve your Web site. Then I'll go into each technique in detail.
JavaScript Form Input Validation
This validation script offers a collection of validation functions, and an easy way to use them in your form with JavaScript. The submission of a form with invalid data is prevented by returning a false value from the "onsubmit" event handler. The function which does the validation needs nothing more than a basic profile which describes the type of input you expect in each form field. This includes verification for credit card numbers, names and addresses, email addresses, zip codes, and expiration dates.
JavaScript Cookies
The JavaScript cookie functions makeCookie(), readCookie(), and rmCookie() provide a complete set of cookie functions. Designed for usability, they make all the details, like setting expiration dates, easy and fast.
JavaScript Base64 / Base-64 Encoding
These are fast encoding and decoding functions for base64 encoded data. Click "input" and paste either text data or base64 data into the textarea. Then click "encode_base64" or "decode_base64" to encode or decode. Click "output" to see the result, either encoded from the original text input, or decoded from the original base64 input.
Encode Source
This web page will safely encode any data into a JavaScript string expression suitable for use in JavaScript code. It uses the built-in functions escape() and unescape() to safely convert data at high speed.
Properties of the JavaScript Event Object
This web page shows all the properties of the JavaScript event object on both Internet Explorer and Mozilla / Netscape / Firefox.
How JavaScript Regular Expressions Work
On this page are examples of how all JavaScript regular expressions work, which are based on the syntax of Perl regular expressions. A regular expression is a way of writing code for matching values in text input. On this page you can click on any JavaScript regular expression, and then click "Run" in order to see how it works on a basic sentence of input. It shows the matches received, or else reports "No matches" in the status bar of your web browser. It helps a great deal in understanding about regular expressions in JavaScript.
JavaScript Image Scale
JavaScript Image Scale is a wonderful script that enables you to add a terrific toolbar to your web page with three awesome buttons:
Image size: increase, decrease, refresh
Clicking increase automatically enlarges all of the images on the web page. Clicking decrease automatically reduces the size of all the images on the web page. Clicking refresh restores all of the images to their original size.
JavaScript intrinsic events
Visit this web page to see a simple but powerful form where you can "keypress" in one text box (by clicking into the box and typing any key on the keyboard) and instantly see the result of the JavaScript onkeypress event shown in a textarea.

Also, you can "focus" on another text box (just by clicking the box), and you will see the entire results of all the JavaScript onfocus event properties.

Finally, there is a button which you can "click" and see all of the properties of the onclick JavaScript event object.

JavaScript Includes / JSI like Server Side Includes / SSI
How do I make HTML into something like an image, that I can use in my web pages, more than once, without copying it? I want to be able to change the HTML in one area and have it automatically reflected to all the places in my website where it is used. The solution is to use Jsinc, or JavaScript Includes. Since JavaScript is an "active" element of a webpage, you can include the same script across into multiple areas of your website, without re-writing or copying the script.
JavaScript Key Bindings
This utility designed for game programmers and advanced JavaScript developers enables you to bind any JavaScript function to any combination of keys on the keyboard. For example, when someone presses "u" you can trigger the "upAirplane()" function, and so on. You can also add events using the control key, alt key, and shift key.

The resulting keybinding looks very complicated, but it is simple to use. All you have to do is paste it directly into your web page after your functions are defined.

Scale Hexadecimal Colors to Brighter and Darker Values while Preserving True Color Hue
This is one of the most amazing JavaScripts. It will let you type in any color, and then let you pick another color with the exact same color hue, either brighter or darker. It lets you specify an exact mathematical ratio or pick another color from a myriad of shades of your original color, from almost black to nearly white. Just try it. Go to the web page and click "output" in order to see how cool it is! Then try typing a different original color code, like "ffffaa" for yellow, and click "output" again!