1.后台弹出提示信息方法
Response.Write("<script type="text/javascript">alert('你所查询的数据不存在!');</script>");
//弹出提示信息,但页面空白
Page.RegisterClientScriptBloc
//弹出提示信息,但页面空白
Page.RegisterStartupScript("tishi", "<script type="text/javascript">alert('你所查询的数据不存在');</script>");//已过期,
//弹出提示信息,页面不空白
ClientScript.RegisterClientScriptBloc
//弹出提示信息,但页面空白
ClientScript.RegisterStartupScript(this.GetType(), "tishi", "<script type="text/javascript">alert('你所查询的数据不存在!');</script>");
//弹出提示信息,页面不空白
//在vs2005中 需要引入System.Web.Extensions.dll
ScriptManager.RegisterClientScriptBloc
//弹出提示信息,但页面空白
ScriptManager.RegisterClientScriptBloc
//弹出提示信息,但页面空白,this表示page
ScriptManager.RegisterStartupScript(this.btnTiShi, typeof(Button), "tishi", "alert('你所查询的数据不存在!');", true);
//弹出提示信息,页面不空白
ScriptManager.RegisterStartupScript(Page,typeof(Page), "tishi", "alert('你所查询的数据不存在!');", true);
//弹出提示信息,页面不空白
ScriptManager.RegisterStartupScript(this, typeof(_Default), "tishi", script, true);
//弹出提示信息,页面不空白,this表示page
//后台获得confirm返回值,并有选择的执行语句块
C#端:
protected void Page_Load(object sender, EventArgs e)
protected void btnTiShi_Click(object sender, EventArgs e)
JS端:
<script type="text/javascript">