【发布时间】:2013-06-02 23:43:22
【问题描述】:
我似乎无法进一步了解这一点。我更喜欢图形而不是程序员。
每次按下按钮时,我都需要一个按钮来从白色到灰色再到红色再到黑色再到白色。一个 pdf 文件中将有超过一百个这样的按钮。
这是我迄今为止尝试过的:
if (this.getField("Button1").fillColor = ["RGB",1,1,1])
{
app.alert({ cMsg: "Switch to Grey", });
this.getField("Button1").fillColor = ["RGB",.5,.5,.5];
};
if (this.getField("Button1").fillColor = ["RGB",.5,.5,.5])
{
app.alert({ cMsg: "Switch to Red", });
this.getField("Button1").fillColor = ["RGB",1,0,0];
};
if (this.getField("Button1").fillColor = ["RGB",1,0,0])
{
app.alert({ cMsg: "Switch to Black", });
this.getField("Button1").fillColor = ["RGB",0,0,0];
};
if (this.getField("Button1").fillColor = ["RGB",0,0,0])
{
app.alert({ cMsg: "Switch to White", });
this.getField("Button1").fillColor = ["RGB",1,1,1];
};
这可能吗? 谢谢
【问题讨论】:
-
你应该在这里改用
if ... else if ... else。否则,我会看到每个if子句都在执行(因为它们会检查更改的值)。 -
当您比较两个不单独使用 = 的值时。您使用 == 或 === 因为 = 意味着您将值分配给例如变量。
-
@user2446117 怎么了?您最终能找到解决问题的方法吗?
标签: javascript button colors