I am looking at a script that has this code:
Then, later on, it has this code:Code:if ( form.yourName.value.length == 0 ) { alert( "Please provide your name." ); form.yourName.focus(); return false;
My impression is that the first test is superfluous because the second test automatically encompasses the first. I would appreciate someone telling me whether I am missing something.Code:var findSpace = /^(.+) (.+)$/; var matchFlag = form.yourName.value.match( findSpace ); if ( matchFlag == null ) { alert( "Please provide both a first and last name, and resubmit." ); form.yourName.focus(); return false; }
Thanks, as always.
A.



Reply With Quote

Bookmarks