Hi Daz,

The problem is, your form is being submitted. That's why it looks like it
only highlights for a second.

The easiest fix is to change onclick="validateForm()" to onclick="return
validateForm()". The 'onclick' call itself needs to return false to stop
the submit.

You may want to consider using the onsubmit event on the form instead.
This would catch the form being submitted by users hitting Enter.

You also might want to consider attaching the event completely in
JavaScript instead of as an attribute in the HTML. But this is up to you.

Cheers,
Jesse Skinner
http://www.thefutureoftheweb.com/

> Hello All,
>
> I am slowly learning the DOM and Javascript, and have started applying
> scripts for validation, the validation part works fine (I think)
> however the problem is I am trying to highlight fields which do not
> validate and they only highlight for a second (I think while the field
> is checked against a the regular expression).
>
> The pages are:
>
> http://ta.rt-ms.net/validate/emailagent.html
> http://ta.rt-ms.net/validate/assets/js/support.js
>
> Thanks
>
> Daz


******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

Reply via email to