如何使用ONCLICK事件在新的WINDOW中打开
JavaScript的当前图像.
<script> function imgWindow() { window.open("image") } </script>
HTML
<img src="pond1.jpg" height="150" size="150" alt="Johnson Pond" onclick="image()"> <-- Have JavaScript open this image with onclick. <img src="pond2.jpg" height="150" size="150" alt="All-green Pond" onclick="image()"> <-- Have JavaScript open this image with onclick. <img src="pond3.jpg" height="150" size="150" alt="Dutch Pond" onclick="image()"> <-- Have JavaScript open this image with onclick.
解决方法
干得好.
<img src="https://i.imgur.com/7KpCS0Y.jpg" onclick="window.open(this.src)">