更改带有悬停的提交按钮图像
我使用 Post 方法以 html 形式获得以下内容。
<input type="submit" title="" class="myclass" value="" />
并且:
.myclass {
background: url(../images/image1.png) no-repeat; border: none;
width: 165px;
height: 59px;
}
基本上,我需要使用 image1.png 按钮发布表单信息,当悬停时,将调用 image2.png 。您会推荐 CSS 还是 javascript,具体的方法是什么?
谢谢大家,已经解答了!
I have the following in an html form using method Post.
<input type="submit" title="" class="myclass" value="" />
and:
.myclass {
background: url(../images/image1.png) no-repeat; border: none;
width: 165px;
height: 59px;
}
Basically, I need my form information to be posted using an image1.png button, and when hovered, image2.png would be called. Would you recommend CSS or javascript, and what would be the exact way to do it?
Thank you everyone, it's been answered!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
提交按钮:
CSS:
Submit button:
CSS:
如果您可以使用 jquery,请查看此
Events/hover
If you can make use of jquery, have a look at this
Events/hover
不知道为什么,但第二个答案对我不起作用,所以我不得不这样做:
CSS:
Dont know why, but second answer didnt work for me, so i had to do so:
CSS:
CSS 方法对我不起作用,但这个方法有效(vanilla JS):
The CSS approaches haven't worked for me, but this one did (vanilla JS):