using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Web.UI;
///
/// Javascript处理类
///
public class JS
{
public static void Alert(System.Web.UI.Page p, string message)
{
#region
string js = @"";
p.RegisterStartupScript("ms", js);
#endregion
}
//弹出提示消息并返回到指定的页面
public static void AlertAndBack(Page page, string message, string backUrl)
{
page.ClientScript.RegisterClientScriptBlock(page.GetType(), "MessageStr", "");
}
//从架构返回到指定的页面
public static void BackToPage(Page page, string backUrl)
{
page.ClientScript.RegisterClientScriptBlock(page.GetType(), "MessageStr", "");
}
///
/// 弹出Javascript小窗口
///
/// 窗口信息
public static void Alert(string message)
{
#region
string js = @"";
HttpContext.Current.Response.Write(js);
#endregion
}
///
/// 弹出消息框并且转向到新的URL
///
/// 消息内容
/// 连接地址
public static void Alert(string message, string toURL)
{
#region
string js = "";
HttpContext.Current.Response.Write(string.Format(js, message, toURL));
#endregion
}
///
/// 弹出消息框并且转向到新的URL
///
/// 消息内容
/// 连接地址
public static void AlertReFresh(string message, string toURL)
{
#region
string js = "";
if (HttpContext.Current.Handler is System.Web.UI.Page)
{
((System.Web.UI.Page)HttpContext.Current.Handler).RegisterStartupScript("ms", js);
}
else
{
HttpContext.Current.Response.Write(string.Format(js, message, toURL));
}
#endregion
}
///
/// 确定提示
///
///
///
public static void Confirm(string message, string toURL)
{
#region
string location = "location.href='" + toURL + "';";
string js = "";
string ss = string.Format(js, message, location);
HttpContext.Current.Response.Write(ss);
#endregion
}
///
/// 回到历史页面
///
/// -1/1
public static void GoHistory(int value)
{
#region
string js = @"";
HttpContext.Current.Response.Write(string.Format(js, value));
#endregion
}
///
/// 关闭当前窗口
///
public static void CloseWindow()
{
#region
string js = @"";
HttpContext.Current.Response.Write(js);
HttpContext.Current.Response.End();
#endregion
}
///
/// 刷新父窗口
///
public static void RefreshParent(string url)
{
#region
string js = @"";
HttpContext.Current.Response.Write(js);
#endregion
}
///
/// 刷新打开窗口
///
public static void RefreshOpener()
{
#region
string js = @"";
HttpContext.Current.Response.Write(js);
#endregion
}
///
/// 打开页面
///
///
public static void RedirectPage(string url)
{
string js = @"";
js = string.Format(js, url);
HttpContext.Current.Response.Write(js);
}
///
/// 刷新窗体
///
public static void RefreshParentFrame()
{
string js = @" ";
HttpContext.Current.Response.Write(js);
}
///
/// 打开指定大小的新窗体
///
/// 地址
/// 宽
/// 高
/// 头位置
/// 左位置
public static void OpenWebFormSize(string url, int width, int heigth, int top, int left)
{
#region
string js = @"";
HttpContext.Current.Response.Write(js);
#endregion
}
///
/// 转向Url制定的页面
///
/// 连接地址
public static void JavascriptLocationHref(string url)
{
#region
string js = @"";
js = string.Format(js, url);
HttpContext.Current.Response.Write(js);
#endregion
}
///
/// 打开指定大小位置的模式对话框
///
/// 连接地址
/// 宽
/// 高
/// 距离上位置
/// 距离左位置
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
}
///
/// 显示指定大小配置的对话框
///
///
///
public static void ShowModalDialogWindow(string webFormUrl, string features)
{
string js = @"";
HttpContext.Current.Response.Write(js);
}
public static void Xopen(string url)
{
string js = @"";
HttpContext.Current.Response.Write(js);
}
}