如何在被调用函数中获取当前asp文本框的id?
<script type="text/javascript">
$(document).ready(function () {
$("#<%=txtNumeric.ClientID %>").focusout(function () {
var textvalue = $("#<%=txtNumeric.ClientID %>").val();
if (!validateDecimal(textvalue))
return false;
else {
$(this).removeClass("focus");
return true;
}
});
});
function validateDecimal(value) {
var RE = new RegExp(/^\d\d*\.\d\d$/);
if (RE.test(value)) {
return true;
} else {
alert("Please Enter in XX.XX format !");
$(this).addClass("focus");// this keyword is not working here !!
$(this).focus(); // this keyword is not working here !!
return false;
}
}
</script>