Posts Tagged ‘JavaScript’

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:

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: Setting the anchor to update, for example to http://chris-miller.org/88#newAnchor it can be […]

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 […]

JavaScript custom controls

I spend a lot of time writing bespoke content management systems, a lot! I’m always trying to add some small, lightweight additions to make the user experience a little bit better. One means of doing this is by providing some better custom controls which give good user feedback and emulate similar offline controls. One such […]

Get multi-class elements in JavaScript

As any person who uses JavaScript for client side interaction knows, getting elements by their class is one essential thing we need to do over and over again. For the most part using a function equivalent to the one shown below will do. Code Snippit 1: Simplistic getElementsByClass() JavaScript method This function basically checks the […]