バックグラウンドポップアップメッセージメソッド
2231 ワード
1.
Response.Write("alert(' !'); ");
// ,
Page.RegisterClientScriptBlock("tishi", "alert(' '); ");
// ,
Page.RegisterStartupScript("tishi", "alert(' '); ");// ,
// ,
ClientScript.RegisterClientScriptBlock(this.GetType(), "tishi", "alert(' !'); ");
// ,
ClientScript.RegisterStartupScript(this.GetType(), "tishi", "alert(' !'); ");
// ,
// vs2005 System.Web.Extensions.dll
ScriptManager.RegisterClientScriptBlock(this.btnTiShi, typeof(Button), "tishi", "alert(' !');", true);
// ,
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "tishi", "alert(' !');", true);
// , ,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)
{
if (!IsPostBack)
{
this.btnTiShi.Attributes.Add("onclick","tishi()");
}
}
protected void btnTiShi_Click(object sender, EventArgs e)
{
if (this.hidevalue.Value == "1")
{
Response.Write("success");
}
else
{
Response.Write("failue");
}
}
JS :
function tishi()
{
if(confirm(' ?'))
{
document.getElementByIdx_x('hidevalue').value='1';
//window.location.href=window.location.href;
}
else
{
document.getElementByIdx_x('hidevalue').value='0';
}
}