我正在开发一个涉及在不同弹出窗口中打开交互式媒体的网页。我希望焦点在打开时转到最新的窗口。我无法立即打开所有弹出窗口。当下一个窗口打开时,前一个窗口关闭。
这是代码
第一个窗口:
<script language="javascript">
function popup(url) {
var width = 300;
var height = 300;
var left = 200;
var top = 100;
var params = 'width=' + width + ', height=' + height;
params += ', top=' + top + ', left=' + left;
params += ', directories=no';
params += ', location=no';
params += ', menubar=no';
params += ', resizable=no';
params += ', scrollbars=no';
params += ', status=no';
params += ', toolbar=no';
win1 = window.open(url, "laser", params);
if (window.focus) {
win1.focus()
}
return false;
}
setTimeout(function() {popup('laser.html');}, 10000)
</script>
第二窗口:
<script language="javascript">
function popup(url) {
var width = 300;
var height = 300;
var left = 500;
var top = 300;
var params = 'width=' + width + ', height=' + height;
params += ', top=' + top + ', left=' + left;
params += ', directories=no';
params += ', location=no';
params += ', menubar=no';
params += ', resizable=no';
params += ', scrollbars=no';
params += ', status=no';
params += ', toolbar=no';
win2 = window.open(url, "fire", params);
if (window.focus) {
win2.focus()
}
return false;
}
setTimeout(function() {popup('fire.html');}, 13000)
</script>