私はこのコードを持っています:
<input type="button" onclick="alert('A message here');" value="Button"/>
標準のボタンの代わりに独自のイメージ ボタンを使用するにはどうすればよいですか?
<img src="{{your image url here}}" onclick="alert('A message here');" />
また
<div onclick="alert('A message here');" style="background: url({{your image url here}});background-repeat:no-repeat; width:150px; height:100px;"></div>
<button>
の代わりに タグを使用する<input type="button">
と、HTML コンテンツで埋めることができます。
<button onclick="alert('A message here');" type="button">
<img src="myurl">
</button>
ドキュメント: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
画像ボタン自体はありませんが、JavaScript を使用しているため、クリック イベントを画像に追加できます。以下のフィドルを参照してください。
<img class="button" src="http://goo.gl/UGQl0i" width="100" height="100" onclick="alert('A message here');" >
This should work. Just replace "img.png" with your image.
<img src = "img.png" onclick="alert('A message here');"/>