简体   繁体   中英

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

This can be done with HTML+CSS+JS

Fiddle here: http://jsfiddle.net/SReject/yK653/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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