我想知道如何将true
切换为false
,反之亦然:
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(cTID('Chnl'), cTID('Chnl'), cTID('Msk '));
desc1.putReference(cTID('null'), ref1);
desc1.putBoolean(cTID('MkVs'), true);
executeAction(cTID('slct'), desc1, dialogMode);
};
if (a == false) {
!a = true;
} else if (a == true) {
!a = false;
}
答案 0 :(得分:0)
我不知道您要在代码中切换哪个变量,但请注意:
if(a == false) { a = true; } else if (a == true) { a = false; }
您可以将其更改为:
a = !a;