using System.Web;
namespace Ant.Service.Utilities
{
///
/// JavaScript 操作类
///
public class JavaScriptPlus
{
public JavaScriptPlus()
{ }
///
/// 输出自定义脚本信息
///
/// 当前页面指针,一般为this
/// 输出脚本
public static void ResponseScript(System.Web.UI.Page page, string script)
{
page.ClientScript.RegisterStartupScript(page.GetType(), "message", "");
}
#region 回到历史页面
///
/// 回到历史页面
///
/// -1/1
public static void GoHistory(int value)
{
#region
string js = @"";
HttpContext.Current.Response.Write(string.Format(js, value));
#endregion
}
#endregion
#region 关闭当前窗口
///
/// 关闭当前窗口
///
public static void CloseWindow()
{
#region
string js = @"";
HttpContext.Current.Response.Write(js);
HttpContext.Current.Response.End();
#endregion
}
#endregion
#region 刷新父窗口
///
/// 刷新父窗口
///
public static void RefreshParent(string url)
{
#region
string js = @"";
HttpContext.Current.Response.Write(js);
#endregion
}
#endregion
#region 刷新打开窗口
///
/// 刷新打开窗口
///
public static void RefreshOpener()
{
#region
string js = @"";
HttpContext.Current.Response.Write(js);
#endregion
}
#endregion
#region 转向Url指定的页面
///
/// 转向Url指定的页面
///
/// 连接地址
public static void JavaScriptLocationHref(string url)
{
#region
string js = @"";
js = string.Format(js, url);
HttpContext.Current.Response.Write(js);
#endregion
}
#endregion
#region 打开指定大小位置的模式对话框
///
/// 打开指定大小位置的模式对话框
///
/// 连接地址
/// 宽
/// 高
/// 距离上位置
/// 距离左位置
public static void ShowModalDialogWindow(string webFormUrl, int width, int height, int top, int left)
{
#region
string features = "dialogWidth:" + width.ToString() + "px"
+ ";dialogHeight:" + height.ToString() + "px"
+ ";dialogLeft:" + left.ToString() + "px"
+ ";dialogTop:" + top.ToString() + "px"
+ ";center:yes;help=no;resizable:no;status:no;scroll=yes";
ShowModalDialogWindow(webFormUrl, features);
#endregion
}
#endregion
#region 打开模式对话框
///
/// 打开模式对话框
///
/// 链接地址
///
public static void ShowModalDialogWindow(string webFormUrl, string features)
{
string js = ShowModalDialogJavascript(webFormUrl, features);
HttpContext.Current.Response.Write(js);
}
///
/// 打开模式对话框
///
///
///
///
public static string ShowModalDialogJavascript(string webFormUrl, string features)
{
#region
string js = @"";
return js;
#endregion
}
#endregion
#region 打开指定大小的新窗体
///
/// 打开指定大小的新窗体
///
/// 地址
/// 宽
/// 高
/// 头位置
/// 左位置
public static void OpenWebFormSize(string url, int width, int heigth, int top, int left)
{
#region
string js = @"";
HttpContext.Current.Response.Write(js);
#endregion
}
#endregion
///
/// 页面跳转(跳出框架)
///
///
public static void JavaScriptExitIfream(string url)
{
string js = @"";
js = string.Format(js, url);
HttpContext.Current.Response.Write(js);
}
}
}