Home > Article > Web Front-end > Summary of common methods for adding background images to buttons using js
This article mainly introduces the common methods of adding background images to the button in js, and lists three methods of triggering and controlling background images, css style control and image buttons in jsevents, which is very It has practical value. Friends who need it can refer to
. This article describes the common methods of adding background images to buttons in js. Share it with everyone for your reference. The specific implementation method is as follows:
Method one:
The code is as follows:
<input type="submit" onMouseOver="style=background:url('imgs/jb51.gif')"/>
Method two:
The code is as follows:
<input type="button" value="提交" style="background:url(图片地址) no-repeat;border:none;text-indent:-2000px;width:100px;height:30px;">
Method three:
is to use picture buttons, that is:
The code is as follows:
<input name="submit" type="image" value=" " src="jb51.jpg" />
The above is the detailed content of Summary of common methods for adding background images to buttons using js. For more information, please follow other related articles on the PHP Chinese website!