function isNumber(value) { var patrn = /^[0-9]*$/; if (patrn.exec(value) == null || value == "") { return false } else { return true } }
更完整点
function isNumber(value) { var patrn = /^(-)?d+(.d+)?$/; if (patrn.exec(value) == null || value == "") { return false } else { return true } }