62,268
社区成员
发帖
与我相关
我的任务
分享
<script language="javascript" type="text/javascript">
function Check()
{
//打个比方,检查是不是小数
var str = form1.txtNumberOnly.value;
var num = str.match(/^\d+(\.\d+)?$/);
if(num != null)
{
alert("格式正確");
return true;
}
else
{
alert("格式不正確");
return false;
}
}
</script>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtNumberOnly" runat="server"></asp:TextBox>
<asp:Button ID="btnSubmit" runat="server" Text="Button" OnClick="btnSubmit_Click" OnClientClick="if(!Check()){return false;};" />
</div>
</form>
else
{
document.getElementid("HiddenCheck").Value = 0;
}
protected void btnCommit_Click(object sender, EventArgs e)
{ //定义Count = 0;略
foreach (GridViewRow myRow in GridView1.Rows)
{
CheckBox myCheckBox = (CheckBox)myRow.Cells[0].FindControl("chkSelect");
if (myCheckBox.Checked)
{
Count++;
}
}
if (Count == 0)
return;
//去前台Confirm.其实就是给HiddenCheck赋值....
if (HieddnCheck.Value == "1")
{
//Do what you wanna do
}
else return;
}
function Check()
{
if(Confirm)
{
document.getElementid("HiddenCheck").Value = 1;
}
else
{
document.getElementid("HiddenCheck").Value = 1;
}
}
return Confirm("OK?");