我正在尝试设置一个按钮,以便每次用户点击它时,它的不透明度都会上升,直到达到 1。我明白了,但这只适用于第一次点击。接下来的点击会被记录下来,但不会增加不透明度。
document.getElementById('buttonHello').style.opacity+=0.1;
谢谢
编辑:你好,我需要帮助。
最佳答案
做这个DEMO http://jsfiddle.net/techsin/A7eMh/
function ch() {
var x=getComputedStyle(document.getElementById('buttonHello')).getPropertyValue('opacity');
x=(x*1)+.1;
document.getElementById('buttonHello').style.opacity=x;
}
关于javascript - 使用javascript设置按钮的不透明度值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18542839/