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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -