我在 Apex Forms 页面中启用了一个切换按钮,我将其自定义设置为“是”和“否”。我想将按钮的颜色更改为“是”(选择)时为绿色,默认/取消选择为红色。
这是该切换按钮的 html。
按钮的默认颜色-页面内联CSS-
.red-button {
background-color: red!important;
color: #000!important;
}
按钮-->外观-->css类-->添加下面的值
red-button
为按钮分配“静态 ID”。 在按钮上创建单击动态操作。
动作-->执行JavaScript代码
代码-
document.getElementById("Button_static_id").style.backgroundColor = "red";