Adobe LiveCycle ES2 JavaScript if-else,否则不工作
Adobe LiveCycle ES2 JavaScript if-else, else not working
我已经尝试了几天,让一个简单的 if/else
脚本可以工作。
我遇到的问题是当我检查语法时,它说:
error illegal use if reserved word else
我使用的脚本是:
if (aira.delsec.presence = "hidden")
airb.tblair._Row1.addInstance(1)
airb.presence = "visible"
aira.delsec.presence = "visible";
else
airb.tblair._Row1.addInstance(1)
另外,我试过:
if (aira.delsec.presence = "hidden");{
airb.tblair._Row1.addInstance(1)
airb.presence = "visible"
aira.delsec.presence = "visible";
} else
{
aira.delsec.presence = "visible";
}
如果我删除 else
,那么 if
语句就可以正常工作。我真的很忙,如果有任何帮助,我们将不胜感激。
您的 JavaScript 语法错误。尝试:
if (aira.delsec.presence === "hidden") { // use an opening brace, and...
// === to check for equality...
// because = assigns a value
airb.tblair._Row1.addInstance(1); // end with a semi-colon
airb.presence = "visible"; // end with a semi-colon
airb.delsec.presence = "visible"; // end with a semi-colon
} else { // use closing and opening braces
airb.tblair._Row1.addInstance(1); // end with a semi-colon
} // use a closing brace
一定要在学习时使用 linting tool to validate your JavaScript。您将更快地熟悉正确的语法。
我已经尝试了几天,让一个简单的 if/else
脚本可以工作。
我遇到的问题是当我检查语法时,它说:
error illegal use if reserved word else
我使用的脚本是:
if (aira.delsec.presence = "hidden")
airb.tblair._Row1.addInstance(1)
airb.presence = "visible"
aira.delsec.presence = "visible";
else
airb.tblair._Row1.addInstance(1)
另外,我试过:
if (aira.delsec.presence = "hidden");{
airb.tblair._Row1.addInstance(1)
airb.presence = "visible"
aira.delsec.presence = "visible";
} else
{
aira.delsec.presence = "visible";
}
如果我删除 else
,那么 if
语句就可以正常工作。我真的很忙,如果有任何帮助,我们将不胜感激。
您的 JavaScript 语法错误。尝试:
if (aira.delsec.presence === "hidden") { // use an opening brace, and...
// === to check for equality...
// because = assigns a value
airb.tblair._Row1.addInstance(1); // end with a semi-colon
airb.presence = "visible"; // end with a semi-colon
airb.delsec.presence = "visible"; // end with a semi-colon
} else { // use closing and opening braces
airb.tblair._Row1.addInstance(1); // end with a semi-colon
} // use a closing brace
一定要在学习时使用 linting tool to validate your JavaScript。您将更快地熟悉正确的语法。