View Full Version : Disappearing Values

11-02-2006, 07:22 PM
Hello all,

I've been working with this simple html script. It works great in IE and FF but am having problems in Mac Safari.

In Safari, the value entered in the First Name field disappears when the user clicks on the next field. However, the value does not disappear when the user clicks, not on the next field, but on the form, itself. With a couple of alerts, I was able to determine that, even though, the user doesn't see the value, it does exist.

Why is the value disappearing? Any hints or suggestions are greatly appreciated.

Here are the actions to recreate:

Enter a value in the First Name field
Click on the Last Name field

The value disappears

Enter a value in the First Name field
Click anywhere on the form, except in the Last Name field

The value doesn't disappear

Here is the simple html code:
<script language="javascript">

function leftAlignSelect( element )
return true;
function validateByte( element )
return true;

<FORM name=mainForm method=post>

First name:
<input type="text" id="fname" name="fname" size=22 maxLength=22 onblur="validateByte( this );this.style.textAlign='right';" onfocus="leftAlignSelect( this );">

<br />
Last name:
<input type="text" name="lname" />




11-02-2006, 10:19 PM
I don't have Safari (or even a Mac) but it may dislike a couple of things in your code.

Try enclosing values in quotes eg. size="22", and not having spaces in the Javascript brackets, eg.

onblur="validateByte(this); this.style.textAlign='right';"