01.
<script type=
"text/javascript"
>
02.
<!--
03.
function
checkText()
04.
{
05.
var
elem = document.getElementById(
'test_txt'
).value;
06.
if
(elem.match(/[0-9]/i))
07.
{
08.
alert(
"กรอกได้เฉพาะ a-Z, A-Z, ก-ฮ และ _ (underscore)"
);
09.
document.getElementById(
'test_txt'
).value =
""
;
10.
}
11.
}
12.
13.
</script>
14.
<input type=
"text"
name=
"test_txt"
id=
"test_txt"
onkeypress=
"checkText();"
value=
""
/>