What's wrong with my javascript?


i have been working on below script can't find problem:

 

var contact? = this.getfield("contact?").valueasstring; 

var open wound? = this.getfield("open wound?").valueasstring; 

var carried disease? = this.getfield("carried disease?").valueasstring;

var disease = this.getfield("disease").valueasstring;

 

                 

     if (contact?=="yes" && open wound?=="yes" && carried disease?=="yes" && disease=="hiv") event.value = "you should blood test"; 

else if (contact?=="yes" && open wound?=="yes" && carried disease?=="yes" && disease=="hepatitis") event.value = "you should see doctor";

// etc. 

else event.value = ""; 

if (event.value=="you should blood test") event.target.fillcolor = color.green; 

else if (event.value=="you should see doctor") event.target.fillcolor = color.green; 

// etc.  

else event.target.fillcolor = color.white;    

 

i error "syntaxerror: missing ; before statement 1: @ line 2" can't work out what's wrong.

 

essentially, want ask 4 questions , depending on answers, populate recommendation.

 

any appreciated.

thanks!

you cannot include question mark or space in identifier in javascript, change to:

 

var contact = this.getfield("contact?").valueasstring;

var openwound = this.getfield("open wound?").valueasstring;

var carrieddisease = this.getfield("carried disease?").valueasstring;

 

and you'd have change rest of code use these new variable names.



More discussions in JavaScript


adobe

Comments

Popular posts from this blog

after effects warning: unable to create drawing surface

Maximum number of authorizations reached!