<html>
<style>
.disable
{
border-style:none;
border-width: thin;
background-color:Transparent;
color: #CCCCCC;
cursor:wait;
}
</style>
<script type="text/javascript" language="javascript">
function DisableButton()
{
document.getElementById("Button1").className = "disable";
document.getElementById("Button1").value = '正在提交.请稍候!';
document.getElementById("Button1").οnclick=Function("return false;");
return true;
}
document.οnkeydοwn=mykeydown;
function mykeydown()
{
if(event.keyCode==116) //屏蔽F5刷新键
{
window.event.keyCode=0;
return false;
}
}
</script>
<body>
<form id="form1" runat="server">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" CssClass="button112" />
</form>
</body>
</html>
.CS文件
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.Button1.Attributes.Add("onclick", "return DisableButton();");
}
}