I'm using multiple If Statements and I'm getting inconsistent results. Is there a better way to write this so the form updates the return value consistently and accurately?
var p1 = +getField("package").value;
var c1 = +getField("Chapel").value;
var h1 = +getField("honors").value;
if (h1==1 && c1==1) photo=40
if (h1==1 && c1==1) video=200
if (h1==1 && c1==1) both=240
if (h1==1 && c1==0) photo=0
if (h1==1 && c1==0) video=100
if (h1==1 && c1==0) both=100
if (h1==0 && c1==1) photo=40
if (h1==0 && c1==1) video=100
if (h1==0 && c1==1) both=140
if (p1==7) p2=995+both
if (p1==6) p2=895+both
if (p1==5) p2=795+both
if (p1==4) p2=445+video
if (p1==3) p2=645+photo
if (p1==2) p2=555+photo
if (p1==1) p2=445+photo
event.value=p2;
1. You can use the block brackets, '{' and '}', to indicate a block of code to be executed.
2. defne all variabales being used.
3. initialize variables or computed results to an initial state.
George Kaiser