简体   繁体   English

更改所有活动链接javascript CSS的颜色

[英]Change color of all active links javascript CSS

I have several buttons on a page which change color from blue to red when pressed down. 我在页面上有几个按钮,按下时会将颜色从蓝色变为红色。 I want a reset button to reset the colors of the buttons to blue without having to reload the entire page. 我想要一个重置按钮,将按钮的颜色重置为蓝色,而无需重新加载整个页面。 Is this possible? 这可能吗?

<button id="btn" onClick="style.backgroundColor='red'; style.border='3px solid red'; style.color='#FFF';">Copy</button>

这将有助于http://jsfiddle.net/3hqnU/简单使用jquery

You can set 你可以设置

onmouseup="this.style.backgroundColor='blue'"

but like Andy said, you should use CSS classes, switching between them, for this kind of styles 但就像Andy所说,你应该使用CSS类,在它们之间进行切换,以获得这种风格

This can be done with HTML+CSS+JS 这可以使用HTML + CSS + JS完成

Fiddle here: http://jsfiddle.net/SReject/yK653/ 在这里小提琴: http//jsfiddle.net/SReject/yK653/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM