if (outstr == "成功")
                {
                    Errlog.Text = "注册成功,请返回<a href=Login_user.aspx>重新登陆</a>查询您的余额";
                  
                   Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Key", "<script>if(!confirm('注册成功,点确定充值!否则取消充值?')) { window.location.replace('Login_user.aspx');}else{document.all.btnOK.click();}</script>");
                    //此调用充值
                   
                }
 protected void btnOK_Click(object sender, EventArgs e)
    {
        MobileCharge(Phoneno.Text.Trim(), Pwd.Text.Trim());
    }
问题是,弹出来的框框点确定也好,取消也好,现在全返回到'Login_user.aspx'。按理说只能点取消才能返回到'Login_user.aspx'
点确定执行btnOK_Click这个的啊?现在不是?

解决方案 »

  1.   

    to 问题是,弹出来的框框点确定也好,取消也好,现在全返回到'Login_user.aspx'。按理说只能点取消才能返回到'Login_user.aspx'
    点确定执行btnOK_Click这个的啊?现在不是?当然了,不能直接在客户端去调用服务器端的事件
      

  2.   

    前台:
    function btclick(){
    document.getElementById("btn1").click();//btn1是你的这个按钮的ID
    }
    后台:
    if (outstr == "成功")
                    {
                        Errlog.Text = "注册成功,请返回<a href=Login_user.aspx>重新登陆</a>查询您的余额";
                      
                       Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Key", "<script>if(!confirm('注册成功,点确定充值!否则取消充值?')) { window.location.replace('Login_user.aspx');}else{btclick();}</script>");
                        //此调用充值
                       
                    }
     protected void btnOK_Click(object sender, EventArgs e)
        {
            MobileCharge(Phoneno.Text.Trim(), Pwd.Text.Trim());
        }
    你可以试试
      

  3.   

    楼上的,还是不对,用你方法,确定取消全返回到这个‘'Login_user.aspx’页面
      

  4.   

    Page.ClientScript.RegisterStartupScript(this.GetType(), "Key", "<script language='javascript'>if(confirm('注册成功,点确定充值!否则取消充值?')){window.location.replace('Login_user.aspx');} else{document.getElementById('btnOK').click();}</script>");