92 lines
3.6 KiB
C#
92 lines
3.6 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Text;
|
|||
|
|
|
|||
|
|
namespace Song.Extend
|
|||
|
|
{
|
|||
|
|
public class Scripts
|
|||
|
|
{
|
|||
|
|
private System.Web.UI.Page _page=null;
|
|||
|
|
public Scripts(System.Web.UI.Page page)
|
|||
|
|
{
|
|||
|
|
this._page = page;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>JavaScript<70><74>ʾ<EFBFBD><CABE>ʾ,<2C><><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>ҳ<EFBFBD><D2B3>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ʾʱ<CABE><CAB1>ҳ<EFBFBD><D2B3>Ϊ<EFBFBD>հף<D5B0>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="say">Ҫ<><D2AA>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ϣ</param>
|
|||
|
|
public void Alert(string say)
|
|||
|
|
{
|
|||
|
|
if (say != "")
|
|||
|
|
{
|
|||
|
|
say = say.Replace("\\", "\\\\");
|
|||
|
|
say = say.Replace("\r", "");
|
|||
|
|
say = say.Replace("\n", "");
|
|||
|
|
string script = "<script language='JavaScript' type='text/javascript'>alert('{say}');</script>";
|
|||
|
|
script = script.Replace("{say}", say);
|
|||
|
|
if (this._page == null) return;
|
|||
|
|
if (!_page.ClientScript.IsStartupScriptRegistered(_page.GetType(), "alert"))
|
|||
|
|
{
|
|||
|
|
_page.ClientScript.RegisterStartupScript(_page.GetType(), "alert", script);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
public void AlertAndFresh(string say)
|
|||
|
|
{
|
|||
|
|
if (say != "")
|
|||
|
|
{
|
|||
|
|
say = say.Replace("\\", "\\\\");
|
|||
|
|
string script = "<script language='JavaScript' type='text/javascript'>alert('{say}');window.location.href=window.location.href;</script>";
|
|||
|
|
script = script.Replace("{say}", say);
|
|||
|
|
if (this._page == null) return;
|
|||
|
|
if (!_page.ClientScript.IsStartupScriptRegistered(_page.GetType(), "alert"))
|
|||
|
|
{
|
|||
|
|
_page.ClientScript.RegisterStartupScript(_page.GetType(), "alert", script);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>JavaScript<70><74>ʾ<EFBFBD><CABE>ʾ,<2C><>ʾ<EFBFBD>꣬<EFBFBD>رմ<D8B1><D5B4>ڣ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD><EFBFBD>ʾ
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="say"></param>
|
|||
|
|
public void AlertAndClose(string say)
|
|||
|
|
{
|
|||
|
|
if (say != "")
|
|||
|
|
{
|
|||
|
|
say = say.Replace("\\", "\\\\");
|
|||
|
|
string script = "<script language='JavaScript' type='text/javascript'>alert('{say}');window.close();</script>";
|
|||
|
|
script = script.Replace("{say}", say);
|
|||
|
|
if (this._page == null) return;
|
|||
|
|
if (!_page.ClientScript.IsStartupScriptRegistered(_page.GetType(), "AlertAndClose"))
|
|||
|
|
{
|
|||
|
|
_page.ClientScript.RegisterStartupScript(_page.GetType(), "AlertAndClose", script);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>JavaScript<70>رմ<D8B1><D5B4>ڣ<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
public void Close()
|
|||
|
|
{
|
|||
|
|
string script = "<script language='JavaScript' type='text/javascript'>window.close();</script>";
|
|||
|
|
if (this._page == null) return;
|
|||
|
|
if (!_page.ClientScript.IsStartupScriptRegistered(_page.GetType(), "Close"))
|
|||
|
|
{
|
|||
|
|
_page.ClientScript.RegisterStartupScript(_page.GetType(), "Close", script);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD>JavaScriptʵ<74><CAB5>ҳ<EFBFBD><D2B3>ת<EFBFBD><D7AA>
|
|||
|
|
/// </summary>
|
|||
|
|
public void GoUrl(string url)
|
|||
|
|
{
|
|||
|
|
string script = "<script type=\"text/javascript\">window.parent.location.href='" + url + "';</script>";
|
|||
|
|
if (this._page == null) return;
|
|||
|
|
if (!_page.ClientScript.IsStartupScriptRegistered(_page.GetType(), "GoUrl"))
|
|||
|
|
{
|
|||
|
|
_page.ClientScript.RegisterStartupScript(_page.GetType(), "GoUrl", script);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|