/// <summary>
/// 判断是否为数字
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public bool IsNumeric(string value)
{
return Regex.IsMatch(value, @"^\d+(\.)?\d*$");
/// 判断是否为数字
/// </summary>
/// <param name="value"></param>
/// <returns></returns>
public bool IsNumeric(string value)
{
return Regex.IsMatch(value, @"^\d+(\.)?\d*$");
}
/(^$)|(^\d+$)/
function validate() {
var start = Ext.getCmp("nbStart").getValue();
if (start && !/(^$)|(^\d+$)/.test(start)) {
return false;
}
return true;
}
-- asp.net 按钮点击代码
<f:Button ID="btnQuery" runat="server" OnClientClick="if(!validate()){return false;}" Text="查 询"></f:Button>