⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dialog.js

📁 J-Blog v1.0 系统配置: web.xml里默认配置为:resin 2.1.14 可根据您的具体服务器配置。 注意链接池就是了! 然后导入database/j-blog.sql 默
💻 JS
字号:

function Dialog()
{
	var Method;
	var Params;
	var Splits;
	var Href;
	var Name;
	var ToolBar;
	var MenuBar;
	var ScrollBar;
	var UrlBar;
	var Status;
	var FullScreen;
	var Resize;
	var Width;
	var Height;
	var Place;
	var Top;
	var Left;
	var ReturnValue;
	var TextValue;
	var ConfirmTrue;
	var ConfirmFalse;

	var ua;
	var ie;
	var MinorVer;
	var IEVer;
	var PopTop;
	var oPopup;
	var timer;
	var TimeOut;
}

Dialog.prototype.Init = function()
{
	this.Method = this.Method?this.Method:"open";
	this.Params = this.Params?this.Params:"";
	this.Splits = this.Splits?this.Splits:"|";
	this.Href = this.Href?this.Href:"about:blank";
	this.Name = this.Name?this.Name:Math.round(Math.random() * 100000);
	this.ToolBar = this.ToolBar?this.ToolBar:"no";
	this.MenuBar = this.MenuBar?this.MenuBar:"no";
	this.ScrollBar = this.ScrollBar?this.ScrollBar:"no";
	this.UrlBar = this.UrlBar?this.UrlBar:"no";
	this.Status = this.Status?this.Status:"no";
	this.FullScreen = this.FullScreen?this.FullScreen:"no";
	this.Resize = this.Resize?this.Resize:"no";
	this.Width = this.Width?this.Width:parseInt(screen.width/2);
	this.Height = this.Height?this.Height:parseInt(screen.height/2);
	this.Place = this.Place?this.Place:"center";
	this.Top = this.Top?this.Top:"30";
	this.Left = this.Left?this.Left:"30";
	this.ReturnValue = this.ReturnValue?this.ReturnValue:"";
	this.TextValue = this.TextValue?this.TextValue:"";
	this.ConfirmTrue = this.ConfirmTrue?this.ConfirmTrue:true;
	this.ConfirmFalse = this.ConfirmFalse?this.ConfirmFalse:false;
	this.ua = navigator.userAgent;
	this.ie = navigator.appName=="Microsoft Internet Explorer"?true:false;
	this.MinorVer = navigator.appMinorVersion.split(";");
	this.IEVer = parseFloat(this.ua.substring(this.ua.indexOf("MSIE ")+5,this.ua.indexOf(";",this.ua.indexOf("MSIE "))));
}

Dialog.prototype.Exit = function() {
	if (this.ie)
	{
		if (this.IEVer < 5.5)
		{
			var str = "<object id=\"noTipClose\" classid=\"clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11\">";
			str += "<param name=\"Command\" value=\"Close\"></object>";
			document.body.insertAdjacentHTML("beforeEnd", str);
			document.all.noTipClose.Click();
		}else{
			window.opener = null;
			window.close();
		}
	}else{
		window.close();
	}
};

Dialog.prototype.Open = function()
{
	Dialog.prototype.Init();

	switch (this.Method)
	{
		case "open":
		switch (this.Place)
		{
			case "center":
			OpenWinTopXY = "top="+((screen.availHeight-parseInt(this.Height.replace("px","")))/2)+",left="+((screen.availWidth-parseInt(this.Width.replace("px","")))/2);
			break;
			
			case "top":
			OpenWinTopXY = "top=0,left=0";
			break;
			
			default:
			OpenWinTopXY = "top="+this.Top+",left="+this.Left+"";
		}

		var obj = window.open (this.Href,""+this.Name+"","location=no;toolbar="+this.ToolBar+",menubar="+this.MenuBar+",scrollbars="+this.ScrollBar+",resizable="+this.Resize+",directories="+this.UrlBar+",fullscreen="+this.FullScreen+",status="+this.Status+",titlebar=no,width="+this.Width+",height="+this.Height+","+OpenWinTopXY+"");
		return (obj);
		break;

		case "showModalDialog":
		var oDialog;
		oDialog = window.showModalDialog (this.Href,""+this.TextValue+"","dialogWidth:'"+this.Width+"';dialogHeight:'"+this.Height+"';status:'"+this.Status+"';scroll='"+this.ScrollBar+"';help:no;edge: Raised");
		return (oDialog);
		break;

		case "showModelessDialog":
		var oDialog;
		oDialog = window.showModelessDialog (this.Href,""+this.TextValue+"","dialogWidth:'"+this.Width+"';dialogHeight:'"+this.Height+"';status:'"+this.Status+"';scroll='"+this.ScrollBar+"';help:no;edge: Raised");
		return (oDialog);
		break;

		case "showHelp":
		window.showHelp(this.Href);
		break;

		case "confirm":
		var msgbox = window.confirm(this.TextValue);
		if (msgbox)
		{
			eval(this.ConfirmTrue);
		}else{
			eval(this.ConfirmFalse);
		}
		break;

		case "popup":
		if (this.ie)
		{
			this.PopTop=50;
			this.oPopup = window.createPopup();
			var html=this.TextValue;
			this.oPopup.document.body.innerHTML = html;
			popshow();
		}
		break;

		default:
		top.location=this.Href;
		break;
	}
}

Dialog.prototype.Reload = function(frms,url)
{
	document.forms[frms].action = url;
	document.forms[frms].submit();
}

Dialog.prototype.ie = function()
{
	return (this.ie);
};

Dialog.prototype.getIEVersion = function()
{
	return (this.IEVer);
};

Dialog.prototype.getScriptEngineVersion = function() {
	return ScriptEngine()
		+ " " + ScriptEngineMajorVersion()
		+ "." + ScriptEngineMinorVersion()
		+ "." + ScriptEngineBuildVersion();
};

function sAlert(title,description,width,height)
{
	this.url = root.path + "alert.jsp?title="+title+"&description="+description;
	this.width = width?width:"350px";
	this.height = height?height:"200px";
	
	dialog.Method = "showModalDialog";
	dialog.Href = this.url;
	dialog.Width = this.width;
	dialog.Height = this.height;
	dialog.Status = "no";
	dialog.Open();
}

var dialog = new Dialog();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -