如何给HTML标记按钮的图像 [英] How to give html button tag an image
本文介绍了如何给HTML标记按钮的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有给HTML按钮标记℃的途径;按钮>
的图像,从而使图像点击能够在我的网页。当用户在图片上点击,我可以有其他的事情,这样发生
这似乎并不奏效,并想知道如果它甚至有可能
HTML code -
<按钮和GT;
< IMG SRC =图像/ dagger.pngWIDTH =10%HEIGHT =10%ID =匕首/>
< /按钮>
解决方案
不太清楚你想什么来实现,但也许这例如帮助。
HTML
<按钮和GT;
< IMG SRC =http://www.w3.org/html/logo/downloads/HTML5_Logo_32.pngID =匕首/>
< /按钮>
JavaScript的
$(函数(){
$(#匕首)。点击(函数(){
警报(点击);
});
});
I am wondering if there is a way to give the HTML button tag, <button>
an image so the image is click-able on my webpage. That way when users click on the image I can have other things happen
This doesn't seem to be working, and was wondering if it is even possible
HTML code -
<button>
<img src="images/dagger.png" width="10%" height="10%" id="dagger" />
</button>
解决方案
Not quite sure what you are trying to achieve but maybe this example helps.
HTML
<button>
<img src="http://www.w3.org/html/logo/downloads/HTML5_Logo_32.png" id="dagger" />
</button>
JavaScript
$(function(){
$("#dagger").click(function(){
alert("click");
});
});
这篇关于如何给HTML标记按钮的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文