Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 JavaScript 设置 HTML 元素的颜色。当我像ele.style.color="red";指定它时没关系 但我想设置颜色,比如ele.style.color=rgb(r,g,b); 其中参数 r,g 和 b 是变量。有办法吗?
尝试
ele.style.color = "rgb("+r+","+g+","+b+")";