Mick White wrote:
> Lee wrote:
>
> > Mick White said:
> >
> >>Lee wrote:
>
> >>
> >>Without this.href="#", a return of "true" might load the non js page, no?
> >
> >
> > Sure, so you simply return false:
> >
> > onclick="if(verify(document.formName)){document.fo rmName.submit()};return false"
> >
>
> I thought that a return "false" might cancel the submission, of course I
> would probably be wrong.
> Thanks, Lee.
> Mick
Returning false from any event handler should, and usually does, stop the element's
default behaviour that triggered the event. It is not specifically related to forms.
Examples for "return false;":
Returning false to the onsubmit event of a <form ...> prevents form submission because
the submission of the form was the triggered event.
Returning false to the onclick event of an <input type="submit" ...> prevents form
submission, but only because it stops the "click" of the submit button, which prevents
the submission.
Returning false to the onclick event of an <a ...> stops the "click" of the link, so
the href attribute never gets followed.
Returning false to the onkeydown event of <input type="text" ...> prevents the key
that was pressed down from appearing in the input.
--
Grant Wagner <>
comp.lang.javascript FAQ -
http://jibbering.com/faq