this.Response.Write("<script language='javascript'>alert('用户注册成功!');</script>");
this.Response.Write("<script language='javascript'>window.location.href('WebForm1.aspx');</script>");
下面:
Response.Write("<script>alert('注册成功')</script>");
Response.Regedit("WebForm1.aspx);
上面是对的 为什么下面没有弹出对话框就直接跳转页面if(document.all("TextName").value=="")是页面上的提示document.alert("不能为空");
document.form1.IDlod.select();
登录的判断
if(document.form1.IDlod.values()=="")
document.alert("用户名不能为空");
document.form1.IDlod.select();
这两个有什么区别
this.Response.Write("<script language='javascript'>window.location.href('WebForm1.aspx');</script>");
下面:
Response.Write("<script>alert('注册成功')</script>");//这个只是输出script, 后台执行完后,加载时 加载到他 他才执行
Response.Regedit("WebForm1.aspx);//这里 就直接跳转了, 没有加载本页的HTML
上面是对的 为什么下面没有弹出对话框就直接跳转页面
this.Response.Write("<script language='javascript'>alert('用户注册成功!');location.href('WebForm1.aspx');</script>");
Response.Write("<script>alert('注册成功')</script>");
这段代码发送一段Javascript脚本,脚本必须发送到客户端后才能执行Response.Regedit("WebForm1.aspx);
这段代码直接就从当前页跳转到webform1.aspx了,也就是当前页面根本就没发送任何内容到客户端,所以你上面的客户端代码永远不会被执行
this.Response.Write("<script language='javascript'>window.location.href('WebForm1.aspx');</script>");
都是执行脚本代码!!
Response.Write("<script>alert('注册成功')</script>");
Response.Regedit("WebForm1.aspx)//是服务器响应