Problem with input focus on Safari

I had a javascript hiccup, and I think the solution may be helpful to others.

The basic setup is this:

Limited space means no room for labels in a login form. So instead we used a preset value in the input elements, like so:

  1.  
  2. <input value="Username" name="username" type="text" />
  3. <input value="Password" name="password" type="text" />
  4.  

Which looks like this:



The easy way to blank out the descriptive text is to use the onfocus event like so:

  1.  
  2. onfocus="this.value=''"
  3.  

Continue reading →