Rick Measham <ri***@spam.com.au> writes:
1. Certain fields have a class 'textfield' while others are
'textfieldreq'.
2. OnSubmit checks all elements and makes sure that those with 'req'
have some value
3. It then sets the border on empty required fields to red
Now what I want to do is:
4. alter the onkeypress for the field
Use onchange instead. It is probably what you want.
5. to restore the original class when someone enters something.
You didn't say that you changed the class, only the border style.
Maybe something like this, in the code that recognizes empty fields:
---
badElement.style.border = "2px solid red"; // or whatever you do
badElement.onchange = function() { this.style.border="";
this.onchange=undefined; };
---
If you insist on using "onkeypress", change "onchange" to it
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'