Category: Javascript

Javascript Stopwatch

StopwatchThe other day I needed a stopwatch to time a talk I was giving, but I had a problem. My stopwatch was ALL the way outside in the garage! Now I obviously wasn't going to get up and get it, so I figured there's gotta be something online. Sure enough, there are quite a few online stopwatches.

After using one, I started to think "Man, I should try to make this, it'll be a good exercise". So I did.

And I failed... Sort of... I've only worked with time in javascript a couple times, so after trying to figure it out for awhile, I modified some code I'd found a couple different javascript stopwatches using. Then I added some cool extra functionality and styled it all up with CSS (with CSS3 features!).

Hopefully you'll find this useful. And if not, at least it looks cool!

Javascript Stopwatch


Creating an Ajax Form

Ajax Contact FormWhen creating forms that need to be validated against a user's input, you can either validate on the client-side (Javascript), or the server-side (PHP in this case).
But if you want to use Javascript, then someone with Javascript turned off could easily submit the form and bypass all validation.

That's where AJAX comes in. You do all the validation on the server-side, but return the results back to the user with Javascript and no page refreshes. It's really the best of both worlds. Plus it degrades good enough if someone has Javascript disabled.