(Javascript)如何使图像打开双链接

(Javascript) How to make a image open double link

本文关键字:链接 图像 何使 Javascript      更新时间:2023-09-26

如何创建这样的代码。当单击一个图像时,将打开两个链接,一个在同一窗口中,另一个作为弹出窗口。

HTML

<img src="http://www.firefall.cc/wp-content/uploads/2015/02/start-download-crack.gif" class="yourlink">

JS:

<script>
$('img.yourlink').click(function(e) {
    e.preventDefault();
    window.open('http://livemecca.blogspot.com');
    window.location.href = 'http://firefall.cc/';
});
</script>