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:HTML Code:<img src="filepath" alt="alt txt" onClick="window.open(this.src);" />
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?Code:[IN HEAD SECTION] function openImg(obj) { window.open(obj.src); } [IN IMG TAG] onClick="openImg(this)"
If you want to view the site here it is: http://craptastic.co.cc


LinkBack URL
About LinkBacks
Reply With Quote
