Sunday, November 14, 2010

How to write out a javascript survey, like the ones you fill out when you join a website or something?

i have to make a survey for a java script assignment, basically input a first name, second name and an email. i want it so if you don't put a name or an email in, it shall alert you to put one in. also if it is filled out correctly then it will alert ';thank you for filling out this survey';


the one here is an edited one but Still does not work properly. please help





%26lt;HTML%26gt;


%26lt;FORM%26gt;





%26lt;SCRIPT LANGUAGE=';JavaScript';%26gt;


function checkForm()


{





if(getElementById(';firstName';).value)=鈥?br>

alert (';First Name is empty';)


}





if(getElementById(';lastName';).value)=';鈥?br>

alert (';LastName is empty';}


}





if(getElementById(';emailAddress';).valu鈥?br>

alert (';Email Address is empty';)


}





}


%26lt;/script%26gt;








First Name:


%26lt;input Type=';text'; name=';firstName'; id=';firstName'; size=';10'; maxlength=';25';%26gt;





%26lt;br%26gt;


%26lt;br%26gt;





Last Name:


%26lt;input Type=';text'; name=';lastName'; id=';lastName'; size=10 maxlength=';25';%26gt;





%26lt;br%26gt;


%26lt;br%26gt;





Email Address:


%26lt;input Type=';text'; name=';emailAddress'; id=';emailAddress'; size=10





maxlength=';25';%26gt;





%26lt;br%26gt;


%26lt;br%26gt;





%26lt;input Type=';submit'; value=';Submit'; onclick=';checkForm()';%26gt;





%26lt;/FORM%26gt;


%26lt;/html%26gt;How to write out a javascript survey, like the ones you fill out when you join a website or something?
My suggestion to you would be to use PHP to store those variables or else you will not have any way to get the variables and read them. also be sure that the Email form is longer than 25. my email is relatively short and is 22 characters. so people with 25 or more will have a problem registering for whatever this page is for.
  • computer security
  • ingrown hair
  • No comments:

    Post a Comment