javascript

Form Validation Pop-Ups

If you have required fields in a form, a nice visual clue for the user is to have a message ‘pop up’ if the field hasn’t been filled in. A simple example of what I mean can be seen here.

Open A New Browser Window

Although best practice dictates that you shouldn’t force a new browser window on a user, sometimes (perhaps for a PDF file) you really want to. If you’re using a transitional doctype, this isn’t a problem. You’d simply use the ‘target’ attribute and set it to ‘_blank’.

Simple Dropdown Menu

In an ideal world, creating a cross-browser dropdown menu would be straight forward. Unfortunately, the world of browsers is far from ideal (as long as Internet Explorer 6 still exists!). For other browsers, the following code works fine:

Animated Page Header

You’ve no doubt seen websites where the header image slowly moves, usually with a landscape or sky scene. Well, here’s how to make your own. Take a look here to see what you’ll be making.

Store User Preferences With Cookies

If you’ve read the snippet ‘Simple Javascript Stylesheet Changer’, you’ll no doubt be wanting to store the user preferences across the site. This can easily be done with the use of cookies.

Combined Style-Changer/Random Header

Due to the comment from BlueCougar on the ‘Javascript Random Header Image’ snippet, I’m writing this snippet to combine the random header and the style changer.