The Scarlet Pimp
Supreme Member
- Apr 2, 2008
- 1,416
- 4,457
I'm using this code to make sure that only numbers are added. If letters are typed into the text window then an alert box pops up. But, here's the problem, it doesn't erase the letters.
This means that someone can still send letters rather than numbers, just by clicking the SUBMIT button. How do I make this script delete the text in the window after the alert box is closed?
---
<form>
<input type="text" value="" name="phone" onBlur="if (! this.value.match(/^[0-9ext()-]+$/)) {alert('Phone number must use only these characters: 0-9 ( ) e x t');}" onfocus="this.value=''; this.onfocus=null">
</form>
---
tsp
This means that someone can still send letters rather than numbers, just by clicking the SUBMIT button. How do I make this script delete the text in the window after the alert box is closed?
---
<form>
<input type="text" value="" name="phone" onBlur="if (! this.value.match(/^[0-9ext()-]+$/)) {alert('Phone number must use only these characters: 0-9 ( ) e x t');}" onfocus="this.value=''; this.onfocus=null">
</form>
---
tsp