标签:style blog class code java tar
后台:
protected void ibtnRegedit_Click(object sender, ImageClickEventArgs e)
{
if (!Page.IsValid || !CheckVCode())
return;
.......
}
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
<script type="text/javascript"> var Ok = true;//false异步没回来不让提交,true异步没回来可以提交 function btnClick() { var val = $("#<%=txtUName.ClientID %>").val(); if (val != "") { $.post("/ashx/CheckUser.ashx", { "loginid": val }, function () { if (arguments[0] == "1") { $("#iE").attr("src", "/Images/dui.ico").show(); Ok = true; Page_ClientValidate(null);//调用全局的方法 if (Page_IsValid) { __doPostBack(‘ctl00$ContentPlaceHolder1$ibtnRegedit‘, ‘‘);//由LinkButton产生参数1:Name非ID } } else { $("#iE").attr("src", "/Images/cha.ico").show(); Ok = false; } } , "text"); } }; </script>
<asp:ImageButton ID="ibtnRegedit" runat="server" ImageUrl="~/Images/az-finish.gif" OnClick="ibtnRegedit_Click" /><asp:LinkButton ID="LinkButton1" runat="server" Visible="False"></asp:LinkButton><input type="button" name="btnSub" onclick="btnClick();" id="" value="完 成" style="height: 20px; width: 50px; border-style:solid none ;" />
网页源码:
<script type="text/javascript"> //<![CDATA[ var theForm = document.forms[‘aspnetForm‘]; if (!theForm) { theForm = document.aspnetForm; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script>
网页源码:
<input type="image" name="ctl00$ContentPlaceHolder1$ibtnRegedit" id="ctl00_ContentPlaceHolder1_ibtnRegedit" src="../../Images/az-finish.gif" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentPlaceHolder1$ibtnRegedit", "", true, "", "", false, false))" style="border-width:0px;" /><input type="button" name="btnSub" onclick="btnClick();" id="" value="完 成" style="height: 20px; width: 50px; border-style:solid none ;" />
普通按钮的另一种提交方式(调用后台事件),布布扣,bubuko.com
标签:style blog class code java tar
原文地址:http://www.cnblogs.com/wjshan0808/p/3714489.html