HTML img onclick Javascript
How do I have JavaScript open the current image in a new WINDOW with an ONCLICK event.
<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.
here you go.
<img src="https://i.imgur.com/7KpCS0Y.jpg" onclick="window.open(this.src)">
This might work for you...
<script type="text/javascript">
function image(img) {
var src = img.src;
window.open(src);
}
</script>
<img src="pond1.jpg" height="150" size="150" alt="Johnson Pond" onclick="image(this)">