4-2.html

来自「Ajax的例子」· HTML 代码 · 共 43 行

HTML
43
字号
<html>
<head>
<title>method</title>
<script language="javascript">
var new_window;
function CreateWindow()
{
	if(!new_window||new_window.closed)
	{
	new_window = window.open("","sub","status,height=200,width=270");
	}else if(new_window.focus) //如果新窗口已经打开,那么将心窗口显示在其他窗口的前面
	{
	 new_window.focus();
	}
	
	new_window.moveTo(0,0);
	parent.window.resizeTo(390,390);
	parent.window.moveTo(350,0);
}

function writeContent()
{
	var content = "<html><head><title>新窗口</title></head>";
	content +="<body><h2>我本将心照明月</h2>"
	content +="<h2></h2>";
	content +="</body>奈何明月照沟渠</html>";
	
	new_window.document.open();	        //打开一个新文档
	new_window.document.write(content);     //输入文档的内容
	new_window.document.close();       //关闭文档
}
</script>
</head>
<body>
<p>
  <input type="button" name="Submit" value="创建窗口" onClick="CreateWindow();">
</p>
<p>
  <input type="button" name="Submit2" value="输出" onClick="writeContent()">
</p>
</body>
</html>

⌨️ 快捷键说明

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