我想用javascript在后台打开一个文件。该代码在 chrome 中运行良好,但在 Firefox (12) 和 Opera 新窗口中在前台打开。
有人知道我在做什么错吗?
这是它的两个文件的代码:
父亲.html:
<html>
<body>
<script>
var son=null;
function openIt(){
son=window.open('son.html','sonpage');
son.blur();
self.focus();
window.focus();
//alert("voy");
return false;
}
</script>
<a href="javascript:void(0)" onClick="openIt(); return false;">Open</a>
<a href="javascript:void(0)" onClick="son.close()">Close</a>
<button type="button" id="play2-video" onclick="son.play()">
play2 video
</button>
<button type="button" id="pause2-video" onclick="son.pausa()">
pause video
</button>
Father Page
</body>
儿子.html:
<html>
<Head>
<script>
function play(){
alert("Play!");
}
function stop(){
alert("Stop!");
}
</script>
</Head>
<Body>
<h1> Son Page</h1>
</Body>
谢谢!