📄 javascript.cs
字号:
using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;
namespace Job111
{
/// <summary>
/// JavaScript 的摘要说明。
/// </summary>
public class JavaScript
{
public static void ShowMessageBox(Page p, string message)
{
string HtmlCode = "";
HtmlCode += "<script language = javascript>alert('" + message +"')</script>";
p.Response.Write(HtmlCode);
}
public static void ShowMessageBox(Page p, string message, int backStep)
{
string HtmlCode = "";
HtmlCode += "<script language = javascript>alert('" + message +"');history.back(" + backStep.ToString() + ")</script>";
p.Response.Write(HtmlCode);
}
public static void Preview(HtmlContainerControl ctrl, string Url)
{
string HtmlCode = "";
HtmlCode += "<tbody><iframe src = '" + Url +"'>";
HtmlCode += "</iframe></tbody>";
ctrl.InnerHtml = HtmlCode;
}
public static void CloseWindow(Page p)
{
string HtmlCode = "<script language = javascript>window.close()</script>";
p.Response.Write(HtmlCode);
}
public static void ShowModeLessDialog(HtmlContainerControl ctrl, string Url)
{
string HtmlCode = "";
HtmlCode += "<Script language = javascript>window.showModelessDialog('" + Url + "');history.back(-1)</script>";
ctrl.InnerHtml = HtmlCode;
}
public static void ShowModeDialog(HtmlContainerControl ctrl, string Url)
{
string HtmlCode = "";
HtmlCode += "<Script language = javascript>window.showModeDialog('" + Url + "')</script>";
ctrl.InnerHtml = HtmlCode;
}
public static void NewWindow(HtmlContainerControl ctrl, string Url)
{
string HtmlCode = "";
HtmlCode += "<script language = javascript>window.open('" + Url +"')</script>";
ctrl.InnerHtml = HtmlCode;
}
public static void NewWindow(Page p, string Url)
{
string HtmlCode = "";
HtmlCode += "<script language = javascript>window.open('" + Url +"')</script>";
p.Response.Write(HtmlCode);
}
public static void ShowObject(HtmlContainerControl ctrl, string Url, int width, int height)
{
string HtmlCode = "";
HtmlCode += "<object width = " + width.ToString() + " height = " + height.ToString() + " data = " + Url + " type = text/html></object>";
ctrl.InnerHtml = HtmlCode;
}
public static void ChangePage(Page p, string Url)
{
string HtmlCode = "";
HtmlCode += "<script language = javascript>location.href = '" + Url + "'</script>";
p.Response.Write(HtmlCode);
}
public static void Confirm(Page p, string Msg, string TrueUrl, string FalseUrl)
{
p.Response.Write("<script language = javascript>");
p.Response.Write("var result = confirm('" + Msg + "');");
if(TrueUrl != "")
{
p.Response.Write("if(result) ");
p.Response.Write("{location.href = '" + TrueUrl + "';}");
}
if(FalseUrl != "")
{
p.Response.Write("if(!result)");
p.Response.Write("{location.href = '" + FalseUrl + "';}");
}
p.Response.Write("</script>");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -