01.
<script type=
"text/javascript"
>
02.
function
validatetxtbox()
03.
04.
{
05.
06.
if
(form1.branch_id.value==
"1"
){
07.
var
re =
new
RegExp(
"-"
,
"g"
);
08.
var
txtfield = document.getElementById(
'branch_new'
).value;
09.
if
(!txtfield.match(re)){
10.
alert(
"กรุณากรอกตาม Format รหัสสาขา - ชื่อสาขา"
);
11.
}
else
{
12.
alert(
"Match,Yessss you got it!"
);
13.
}
14.
}
15.
16.
}
17.
</script>