window.open简单使用

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
 <TITLE>window.open测试</TITLE>
 <script>
var popo1=window.open("about:我是第一个POPO!");
var popo2=window.open("about:我是第二个POPO!");
var popo3=window.open("about:我是第三个POPO!");
//当3个子窗口全部生成后,使主窗口获的焦点
self.focus();
function callPOPO(winName){
	if(!winName||winName.closed) {//当生成的子窗口被关闭后,再调用callPOP函数时的提示信息
		alert("窗口"+ winName +"可能已经被关闭了");
	}else{
//使点击按钮对应的子窗口获的焦点
		winName.focus();
	}
}
</script>
 </HEAD>
 <BODY>
  <button onclick="callPOPO(popo1)">聚焦POPO1</button>
  <button onclick="callPOPO(popo2)">聚焦POPO2</button>
  <button onclick="callPOPO(popo3)">聚焦POPO3</button>
 </BODY>
</HTML>

你可能感兴趣的:(html)