<asp:Button ID="Button1" runat="server" Text="· 提 交 ·" onclick="Button1_Click" UseSubmitBehavior="false" OnClientClick="clickOnce(this, 'Cargando...')"/>
<script type="text/javascript" language="javascript">
function clickOnce(btn, msg) {
// 验证是否做了验证
if (typeof (Page_ClientValidate) == 'function') {
// if we are doing a validation, return if it's false
if (Page_ClientValidate() == false) { return false; }
}
// Ensure that the button is not of type "submit"
if (btn.getAttribute('type') == 'button') {
// The msg attibute is absolutely optional
// msg will be the text of the button while it's disabled
if (!msg || (msg = 'undefined')) { msg = '提交中...'; }
btn.value = msg;
// The magic :D
btn.disabled = true;
}
return true;
}
</script>