在WordPress中单击时弹出HTML

时间:2014-03-12 22:45:22

标签: javascript html wordpress popup

在我使用的WordPress主题中,有一个HTML横幅代码区域。目前它包含以下内容:

<a href="http://bathcitysound.com/streaming/player.html">
<img src="my-image-code-goes-here" /></a>

一切都很好,它的功能应该如此,当点击它时,它会转到特定的页面。但是,实际上我想要发生的是当点击图像时,它会打开一个300像素宽,600像素高的弹出窗口,并将其作为地址:

http://bathcitysound.com/streaming/player.html

我应该在现有代码中添加什么才能使其有效?

1 个答案:

答案 0 :(得分:0)

这应该有效:

<a href="javascript:window.open('http://bathcitysound.com/streaming/player.html','yourWindowTitle','width=300,height=600')">
    <img src="my-image-code-goes-here" />
</a>

您可以在浏览器中尝试访问此网址:

javascript:window.open('http://bathcitysound.com/streaming/player.html','yourWindowTitle','width=300,height=600')