Values aren't submitted for <input type="image"> submit buttons

I want to use images as buttons. The buttons all have the same name (option for example), but different values (edit, delete, et cetera). On the server I want to check which button was clicked. With <input type="image"> the name/value pairs aren't sent to the server, which makes this quite hard to do.

Below I tested some different cases and ended up with a nice solution in JavaScript. Script should be modified to support other images, but the idea is obvious.