.aspx
复制代码 代码如下:
<script language="javascript">
function abc()
{
var mybutton=document.getElementById("Submit1");
mybutton.disabled=true; //变灰
__doPostBack("Submit1",""); //执行服务器端Submit1的click事件
}
</script>
<form id="Form1" method="post" runat="server">
...
<INPUT id="Submit1" type="submit" value="开始上传" name="Submit1" runat="server">
....
</form>
.cs
复制代码 代码如下:
private void Page_Load(object sender, System.EventArgs e)
{
...
this.GetPostBackEventReference(Submit1); //这句很关键,有这句才能让客户端执行服务器端事件。
Submit1.Attributes.Add("onclick","abc();");
....
}
时间: 2024-09-11 10:21:44