Hi All
I'm using the below to limit the input into a text box to just letters,
numbers, hyphens and full stops, but I also need to allow the backspace,
delete and arrow keys to come through. How can I do this?
<script language="JavaS cript" type="text/javascript">
<!--
function onKeyPressBlock Numbers(e)
{
var key = window.event ? e.keyCode : e.which;
var keychar = String.fromChar Code(key);
reg = /^[.a-zA-Z0-9_-]*$/;
return reg.test(keycha r);
}
//-->
</script>
<form>
<input type="text" onkeypress="ret urn onKeyPressBlock Numbers(event); " />
</form>
Thanks
Laphan
I'm using the below to limit the input into a text box to just letters,
numbers, hyphens and full stops, but I also need to allow the backspace,
delete and arrow keys to come through. How can I do this?
<script language="JavaS cript" type="text/javascript">
<!--
function onKeyPressBlock Numbers(e)
{
var key = window.event ? e.keyCode : e.which;
var keychar = String.fromChar Code(key);
reg = /^[.a-zA-Z0-9_-]*$/;
return reg.test(keycha r);
}
//-->
</script>
<form>
<input type="text" onkeypress="ret urn onKeyPressBlock Numbers(event); " />
</form>
Thanks
Laphan
Comment