Click to See Complete Forum and Search --> : Focus on blank entry


florida
03-25-2003, 02:25 PM
The below checks for blank entries in my form but how do I make it focus to the field if it is found to be blank? I tried "focus()" but that doesnt work.

if(document.stand.field1.value == "")
{
alert("Fill in Field1 value");
focus();

}

if(document.stand.field2.value == "")
{
alert("Fill in Field2 value");
focus();
}

khaki
03-25-2003, 02:31 PM
Hi Florida...

It's always dangerous to trust me when I'm in the Javascript forum... but what harm can I do with this little one (if it doesn't work... it doesn't work):

Try:

document.stand.field1.focus()

(and let me know if it works!)

will continue trying until I am finally right...
;) k