|
From: nobody on 5 May 2008 19:32 On Mon, 05 May 2008 09:04:46 +0100, Geoff Cox <gcox(a)freeuk.notcom> wrote: >Hello > >I cannot see why this is not working - the idea being to check the >email address entered and if OK to move to either one of 2 pages - the >move does not happen. > >The code below is in the lower of 2 frames. > >Why?! > >Cheers > >Geoff > > >function getNextPage(){ >var num = Math.random(); > if (num<.5) { > location.href="group1/group1-lab1.htm"; > } else { > location.href="group2/group2-lab1.htm"; > } >} > >function validateEmail ( emailField, errorMsg ) { >emailpat = >/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/; > if( !emailpat.test( emailField.value ) ) { > alert( errorMsg); > emailField.focus(); > emailField.select(); > return false; > } else { > getNextPage(); > } >} > >//--> ></script> > ></head> > ><body> > ><h2>test</h2> > ><form name="emailForm" onsubmit="validateEmail( this.email , 'Please >enter a valid email address')"> >Please enter your email address <input type="text" name="email"> ><input type="submit" value="enter"> ></form> Try to replace type="submit" with type="button" and call validateEmail in onclick event. NNN
First
|
Prev
|
Pages: 1 2 3 4 Prev: Why do mouseup events sometimes fire if the mouse is not released? Next: Unknown runtime error |