62,074
社区成员
发帖
与我相关
我的任务
分享
<asp:Button OnClientClick="return f_doSave();" ID= "btnSave " runat= "server " Width= "50 " Text= "保存 " OnClick= "doSave " />
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
this.btnSave.Attributes.Add( "onclick ", "if(false == f_doSave())return false; ");
}
}
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{ //这里改一下试试
//this.btnSave.Attributes.Add( "onclick ", "return f_doSave(); ");
this.btnSave.Attributes.Add( "onclick ", "javascript:return f_doSave(); ");
}
}
protected void doSave(object sender, EventArgs e)
{
string str = this.txtUserName.Text.Trim();
if (str.Length > 0)
{
Response.Write( " <script> alert( ' " + str + " ') </script> ");
}
}