楼上说的都对,不过如果使用了AJAX控件,上面的方法就不灵了,要这样写
System.Web.UI.ScriptManager.RegisterStartupScript(this.updatepanel1, this.GetType(), "unReport", "alert('保存成功!');window.close();", true);
记得重新编译。
function check(){
if( document.getElementById("用户输入框ID").value=="")
{
alert("用户名不能为空");
}
}
相关的一些验证 你可以去找找 一些正则表达式.
Response.write("");
RegisterClientScriptBlock("", "");
RegisterStartupScript("", "");