当我点击flash播放器(jwplayer 5)时,我正在尝试在新窗口中打开一个可点击的链接。这是代码:
<head>
<script type="text/javascript">
function openwindow()
{
window.open("http://www.example.com","mywindow","menubar=1,resizable=1,scrollbars=1,width=350,height=250");
}
</script>
</head>
<body>
<a href="javascript: openwindow();">
<center><div id="mediaplayer">
<script type="text/javascript" src="player.js"></script>
<script type="text/javascript">
jwplayer("mediaplayer").setup({
flashplayer: "player.swf",
provider:'http',
file: "file.mp4",
screencolor: "000000",
width: "875",
height: "480",
plugins: {
'timeslidertooltipplugin-3': {}
}
});
</script>
</div></center>
</a>
</body>
这在Firefox中很好,但在Chrome中不起作用,在Firefox中,当我点击播放器时,新窗口会打开,但在Firefox中当我点击玩家时,它不会打开,但如果我点击玩家的外部,它会打开。
知道为什么它不起作用吗?
提前感谢
我建议不要使用任何内联javascript。你可以更换线路:
<a href="javascript: openwindow()">
带有:
<a href="#" id="linkId">
并将该函数添加到您的script
标签中。所以它最终看起来是这样的:
<a href="#" id="linkId">
<center>
<div id="mediaplayer">
<script type="text/javascript" src="player.js"></script>
</div>
</center>
</a>
<script type="text/javascript">
jwplayer("mediaplayer").setup({
flashplayer: "player.swf",
provider:'http',
file: "file.mp4",
screencolor: "000000",
width: "875",
height: "480",
plugins: {
'timeslidertooltipplugin-3': {}
}
});
document.getElementById("linkId").onclick = function(){
window.open("http://www.example.com","mywindow","menubar=1,resizable=1,scrollbars=1,width=350,height=250");
}
</script>