How do I make an input button with the type of image, link to another page. Asp.net JavaScript...etc...
<input type="image" src="blah blah" onclick="">
How do I make it link onclick?
Four options
The non javascript way.
<form method="get" action="mypage.aspx">
<input type="image" src="blah blah">
</form>
The inline javascript way
<input type="image" src="yourImage.gif" onclick="window.location.href = 'mypage.aspx';">
The jQuery way
<input type="image" src="yourImage.gif" data-target="mypage.aspx">
<script>
$('input[type=image]').click(function(e) { e.preventDefault(); window.location.href = $(this).data('target'); })
</script>
The non button way
<a href="mypage.aspx" style="border:none"><img src="myimage"></a>
You can try something like:
<input type="image" src="yourImage.gif"
onclick="window.location.href = 'anotherPage.aspx';">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.