的JavaScript天才的存在,中的JavaScript的LiveCycle - 对象
期望的结果是为“建议”和“授权”显示,如果任一两个复选框被选中。
/*For Checkbox1: Fund1 */
if (this.rawValue == "1") {
this.resolveNode("fund1").presence = "visible";
this.resolveNode("recommend").presence = "visible";
this.resolveNode("authorization").presence = "visible";
} else {
this.resolveNode("fund1").presence = "hidden";
this.resolveNode("recommend").presence = "hidden";
this.resolveNode("authorization").presence = "hidden";
}
/*For Checkbox2 - Fund2: */
if (this.rawValue == "1") {
this.resolveNode("fund2").presence = "visible";
this.resolveNode("recommend").presence = "visible";
this.resolveNode("authorization").presence = "visible";
} else {
this.resolveNode("fund2").presence = "hidden";
this.resolveNode("recommend").presence = "hidden";
this.resolveNode("authorization").presence = "hidden";
}
如果我选中一个复选框,则会显示所需的“推荐”和“授权”对象。如果我选中两个复选框,然后取消选中一个,隐藏“推荐”和“授权”对象。其他基金的复选框在表单上有不同的审批要求。
是什么导致了这个问题?什么解决它?什么是更清晰的编写代码的方式?所有的指导表示赞赏。