...

View Full Version : Disappearing Values



doyenne
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:

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

Result:
The value disappears

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

Result:
The value doesn't disappear


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

function leftAlignSelect( element )
{
element.style.textAlign='left';
element.select();
return true;
}
function validateByte( element )
{
return true;
}
</script>
</head>

<body>
<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" />

</form>
</body>
</html>

=========================================================

Thanks,
doyenne

mark87
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';"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum