validation/setfocus problem using javascript

by Rebecca Campbell <rcampbel(at)standard.com>

 Date:  Mon, 10 Jan 2000 16:42:35 -0800
 To:  hwg-techniques(at)mail.hwg.org
  todo: View Thread, Original
hi, all!

i am having an ie5.0 problem with my validation script.  what it's supposed
to do is:
1) check if the field is blank and, if it is...
2) link to my anchor so that the page scrolls up far enough to read
necessary text
3) set focus in the field they've missed
4) put up an alert to tell them why this is happening
5) return false so the form doesn't submit

all these work except for #3.  or rather, it sets focus to the appropriate
field, and then puts up the alert and unsets the focus.  so, i've tried
rearranging things so that it sets focus -after- it calls the alert, and
this doesn't work either.

the javascript is as follows:

function inputcheck () {

if (document.myForm.fieldOne.value == "") {
	document.location=('#comeHere');
	document.myForm.fieldOne.focus( );
	alert ("Please enter your info");
	return false;
	}
}

again, this works in ie4, nn4.02, nn4.5...  just not ie5.0. 

any ideas?

thanks!
-rebecca
http://www.nerdygirl.com

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.