<script src="../Scripts/jquery-1.4.4.js" type="text/javascript"></script>
<script type="text/javascript">
//只能输入数字
function InputLimits(id) {
if (typeof id == 'object') {
$.each(id, function () {
$("#" + this).bind("keyup", "", function (e) {
$(this).val($(this).val().replaceNaN());
}).bind("blur", "", function () {
$(this).val($(this).val().replaceNaN());
}).bind("paste", "", function () {
return false;
});
});
} else if (typeof id == 'string') {
$("#" + id).bind("keyup", "", function (e) {
$(this).val($(this).val().replaceNaN());
}).bind("blur", "", function () {
$(this).val($(this).val().replaceNaN());
}).bind("paste", "", function () {
return false;
});
}
}
//替换非数字
String.prototype.replaceNaN = function(){
return this.replace(/[^0-9]/g, '')
}
$(document).ready(function () {
InputLimits(['<%=tbEndStock.ClientID %>', '<%=tbCurrentOutStock.ClientID %>', '<%=tbPendStock.ClientID %>', '<%=tbEarmark.ClientID %>']);
});
</script>