页面使用
<script type="text/javascript">
//新增数据合法性检测
function CheckAdd() {
var ret = true;
if ($id("txt_name").value == "") {
alert('请输入用户名');
ret = false;
}
else if ($id("txt_order").value == "") {
alert('请输入排序编号');
ret = false;
}
else if (!IsPlusInt($id("txt_order").value)) {
alert('排序编号必须为整数');
ret = false;
}
return ret;
}
</script>
后台
btn_add.Attributes.Add("onclick", "return CheckAdd()");//加入验证