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

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

怪我咯
Release: 2017-07-07 14:56:22
Original
2917 people have browsed it

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;)"/>
Copy after login

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;">
Copy after login

Method three:
is to use picture buttons, that is:

The code is as follows:

<input name="submit" type="image" value=" " src="jb51.jpg" />
Copy after login


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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template