Archive for April 2010

Filtered keystrokes with JavaScript

This small set of scripts should give you a starting point for filtering the valid input to certain form fields to ensure that you shouldn’t end up with input that you don’t want*. Basically you’d have the following javascript functions defined: function isNumber( evt ) { valid = true; if( evt.which || ( evt.which != [...]

Getting and Setting anchors with JavaScript

Something I’ve been playing with recently that’s not very well documented is using JavaScript to retrieve and to update the current page anchor from a URL. It’s very simple to do. In order to retrieve the page anchor (i.e. get test from http://chris-miller.org/88#test: var anchor = self.document.location.hash.substring( 1 ); Setting the anchor to update, for [...]

Fade between two divs using mootools

I’ve been playing with mootools for a while, they’re very nice, making easy work of some nice visual tweens and effects. One thing I was struggling a bit to do was fade between two divs, having the first one fade out then the second fade in. Rather than grabbing a plugin to do it I [...]

Sequel Pro: Manage MySQL Databases under Mac OS X

I do a lot of web development; it’s my full time job, my hobby and a means to potentially earn some money on the side. I need a set of good tools in order to make aspects of the work easier or I’d spend my entire life at odds with what I do. A good [...]