xwindow.js

来自「一个非常好的jsp+wml的例子(包括代码) 源码,对初接触wap编程的爱好者 」· JavaScript 代码 · 共 54 行

JS
54
字号
function _xwindow()
{
	var _db = new Array();
	var _s = 0;
	this.title = "xwindow";
	this.hasLogo = false;
	this.logo = null;
	this.content = null;
	this.width = 150;
	this.height = 200;
	this.attach = function(a, p)
	{
		_db[_s++] = Array(a, p);
	}
	this.remove = function()
	{
		while (_s) _s--;
		_db = new Array();
	}
	this.open = function()
	{
		var html = '<html>'
		+ '<head>'
		+ '<title>'+ this.title +'</title>'
		+ '<style><!--'
		+ '.{font-size: 12px}'
		+ 'table {table-layout: fixed; word-wrap:break-word;}'
		+ '--><!--/style>'
		+ '</head>'
		+ '<body topmargin="3" leftmargin="3">'
		+ '<table width="100%" border="0" cellspacing="0" cellpadding="1">';
		if (this.hasLogo==true)
		{
			html += '<tr><td align="center"><img src="'+ this.logo +'" border="0" /></td></tr>';
		}
		html += '<tr><td align="center">'+ this.title +'</td></tr>';
		if (!isEmpty(this.content))
		{
			html += '<tr><td align="center">'+ toHTML(this.content) +'</td></tr>';
		}
		for (var i=0; i<_db.length; i++)
		{
			html += '<tr><td align="'+ _db[i][0] +'">'+ _db[i][1] +'</td></tr>';
		}
		html += '</table>'
		+ '</body>'
		+ '</html>';
		var op = window.open('','xwindow','width='+ this.width +',height='+ this.height +',top='+ (screen.height - this.height)/2 +',left='+ (screen.width - this.width)/2 +',toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no');
		op.document.open('text/html','replace');
		op.document.write(html);
		op.document.focus();
	}
}

⌨️ 快捷键说明

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