Far Too Easy JavaScript

Published on 25 July 2003 in , , ,

Funny how sometimes you think things will be harder than they are. I just finished off the form box clearing JavaScript for Planet Bods, so that as well as working with input text boxes (single line text boxes), it also works with textareas (multiple line text boxes).

I was all geared up to do incredibly complex stuff with the DOM and I didn’t have to, cos everything was extremely straightforward. Humpf. I feel cheated now. JavaScript should be ridiculously complex, else what’s the point of it!

Anyway, the revised script is rather simple. In a HTML form, it clears a text box of it’s dummy text when you focus on it it. If you type something in, and then move to another box, it keeps that content.

If you don’t type anything in, it restores the dummy text. Exciting eh? Best place to see it in action is the Planet Bods Email Page if you care enough. It amuses me anyway.