Home  >  Article  >  Web Front-end  >  Summary of common methods for adding background images to buttons using js

Summary of common methods for adding background images to buttons using js

怪我咯
怪我咯Original
2017-07-07 14:56:222882browse

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(&#39;imgs/jb51.gif&#39;)"/>

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn