javascript - "If" "else" statement with syntax error -
having problems following code syntax error @ line 11, 12, 13.
// field values var dp = +getfield("design_projection").value; var tc = +getfield("asbuilt_top_of_concrete").value; var ge = +getfield("asbuilt_ground_elevation").value; // if dp n/a, set field display n/a if (dp === n/a); { event.value = "na"; // display n/a in field } else { //...otherwise, set field value result of following calculation event.value = ((tc - ge) * 1000); }
you have several issues line:
if (dp === n/a); {
first, note if
should in lower-case (if
). second, note have semicolon after if
statement. makes language think code should interpreted
if (dp === n/a) ; // nothing { event.value = "na"; // display n/a in field } else { //...otherwise, set field value result of following calculation event.value = ((tc - ge) * 1000); }
from this, should clearer error - there's mysterious else
floating around!
if remove semicolon , change if
if
, error should go away.
hope helps!
Comments
Post a Comment