nightbandit
New Member
- Messages
- 53
- Reaction score
- 0
- Points
- 0
I'm trying to link images with JavaScript. This is what I'm currently doing:
But I want to have a function to make it easier on myself. Here's what I've tried:
But it's not working. I'm new to JavaScript so could someone please explain the problem to me, and maybe tell me how to fix it?
If you want to view the site here it is: http://craptastic.co.cc
HTML:
<img src="filepath" alt="alt txt" onClick="window.open(this.src);" />
Code:
[IN HEAD SECTION]
function openImg(obj)
{
window.open(obj.src);
}
[IN IMG TAG]
onClick="openImg(this)"
But it's not working. I'm new to JavaScript so could someone please explain the problem to me, and maybe tell me how to fix it?
If you want to view the site here it is: http://craptastic.co.cc
Last edited: