Reputation: 673
I can't seem to generate a image button or action link that will go to a javascript function.
Examples:
<input type="image" src="<%= Url.Content("~/Content/Images/clear1.png") %>" onclick="NCRClear();" />
The above example will try to do a form submit. I just want it to go to the Javascript function NCRClear().
<a href=<img src="<%= Url.Content("~/Content/Images/clear1.png") %>" alt="Clear" /> onclick="NCRClear();">Clear</a>
I can't get the action link syntax correct with a image.
Any ideas?
Upvotes: 0
Views: 4370
Reputation: 24236
Instead of using an 'image' input type that I believe performs a form submit by default, could you just use a link that wraps your image, something like -
<a href="#" onclick="NCRClear();"><img src="<%= Url.Content("~/Content/Images/clear1.png") %>"/></a>
Upvotes: 2