//首先要在PageLoad()事件中注册属性
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Button1.Attributes.Add("onclick", "return checkSame()");//为Button1添加onclick()事件 ,Button为服务器控件
}//注意:checkSame()这是一个写在aspx面页的js函数,必须有返回值,为:true 或 false
}
//接着写Button1的onclick事件,如果刚才的checkSame()返回为true则招行下面的事件,否则不执行
protected void Button1_Click(object sender, ImageClickEventArgs e)
{
SqlParameter[] Params = new SqlParameter[2];
Params[0] = dbs.MakeInParams("@uid", SqlDbType.VarChar, 10, Session["Uid"].ToString());
Params[1] = dbs.MakeOutParms("@Upwd", SqlDbType.VarChar, 10);
if (dbs.ExecuteNonQuery(CommandType.StoredProcedure, "selectPwd", Params) > 0)
{
string userPwd = Params[1].Value.ToString();
if (userPwd != this.old_pwd.Text)
{
Response.Write("<script>alert('原始密码错误!')</script>");
}
else
{
}
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('操作失败!')</script>");
}
}
//呵呵。。再写一个js试例吧
function checkSame()
{
var Obj1=document.getElementById ("new_pwd").value;
var Obj2=document.getElementById ("re_new_pwd").value;
if(Obj1!=Obj2)
{
alert("两次密码输入不一致!");
document.getElementById("new_pwd").focus();
return false;
}
else
{
return true;
}
}
//明白了吗。。这是一个用来判断两次密码输入是否一致的函数
分享到:
相关推荐
Sirenix.OdinInspector.Attributes.dll
1. 打开新的窗口并传送参数: ...Button1.Attributes.Add("onclick","return confirm(’确认?’)"); button.attributes.add("onclick","if(confirm(’are you sure...?’)){return true;}else{return false;}")
Button1.Attributes.Add("onclick","window.showModalDialog('../Dialog/DialogForm.aspx',window)"); 步骤二:父页面页面脚本函数。 function setAttaches(strboxValue) { document.getElementById("lblSign")....
org-gephi-data-attributes-api可视化软件gephi的插件,nbm格式,
Button1.Attributes.Add("onclick","return confirm(’确认?’)"); button.attributes.add("onclick","if(confirm(’are you sure...?’)){return true;}else{return false;}") 3.删除表格选定记录 int intEmpID = ...
datagridview 表头 case DataControlRowType.Header: ... //tcHeader[1].Attributes.Add("bgcolor", "Red"); tcHeader[1].Attributes.Add("colspan", "6"); //跨Column tcHeader[1].Text = "全部信息</th></tr><tr>";
今天在开发过程中发现一个问题,在asp:Button按钮属性Enabled="false"时,也就是按钮变类...解决的方法是在后台代码的 Page_Load(object sender, EventArgs e)里添加Button1.Attributes.Add("onclick", "showAlert()");
Button1.Attributes.Add("onclick","return confirm('确认?')"); button.attributes.add("onclick","if(confirm('are you sure...?')){return true;}else{return false;}") 3.删除表格选定记录 int intEmpID = (int...
Backbone.Attributes 是一个很小的(约 400 字节缩小/gz)插件,用于提供任何对象 Backbone.Model getter/setter 方法。 有时模型太重,或者您不需要 Backbone 模型提供的完整同步/收集方法。 var view = new ...
BtnDel.Attributes.Add("onclick","return confirm('"+"确认删除?"+"')"); 2. linktempDelete.Attributes["onclick"]="javascript:return confirm('"+"确认删除?"+"');"; 3. private void grdProject_...
Button1.Attributes.Add("onclick","return confirm('确认?')"); button.attributes.add("onclick","if(confirm('are you sure...?')){return true;}else{return false;}") 接收参数: string a = Request....
一个对XmlDocument的DocumentElement 以及其属性Attributes进行访问的类库函数。
(tag.Attributes.ContainsKey("class") && tag.Attributes["class"] == "result-item")) continue; if (!parser.ParseNext("a", out tag)) continue; if (!tag.Attributes.ContainsKey("href")) continue; list....
1. 打开新的窗口并传送参数: 传送参数: response.write(“[removed]window.open(‘*.aspx?...Button1.Attributes.Add(“onclick”,”return confirm(‘确认?’)”);button.attributes.a
Nhibernate拒绝配置文件(NHibernate.Mapping.Attributes的使用)
在网上找了找,发现有三种方法可以访问到前台代码: 第一种,OnClientClick (vs2003不... 第二种,Button1.Attributes.Add(“onclick”, “return Client_Click()”); “Client_Click() “是一个前台方法,可以替换成一
commons-attributes-2.2.zipcommons-attributes-2.2.zipcommons-attributes-2.2.zipcommons-attributes-2.2.zipcommons-attributes-2.2.zipcommons-attributes-2.2.zip
e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor"); ...