Got an odd situation – when I change the “type” of my button from “button” to “image”, it stops working. I have done this change 100 times on my site, and I’ve never come across this issue before.
The relevant code looks like this:
//working
<input type="button" value="Back" onClick="window.location='some/page.php'" />
//not working
<input type="image" src="/link/to/image.png" onClick="window.location='some/page.php'" />
I’ve tested it by using the first code and checking it transfers me to the desired page. Then I’ve simply changed the type over and replaced the “value” with the relevant “src”. The button displays fine but when clicked, I simply land back on the page I was originally on.
What’s really bugging me is that the second snippet of code is working absolutely fine across the rest of my site. It’s just this page that it’s not working on.
Really confused – anyone encountered this before or got any suggestions?
You have probably put the image map in a form. When you click it you are submitting the form.
You should use a regular link instead. There is no need to use an image map or JavaScript here.