View Full Version : stats using form validation

03-26-2005, 08:16 PM
Hi all.
I'm new to java script I have been trying to work this several ways
the user enters his name
and three differnt shot types
then a prompt window appears after the info is entered in the txt fields.
I'm not trying to do pattern recognition just a simple form is all.
So what am i ding wrong?
when I take out the script marked red it works fine?

function validate(formCheck) //Function with a parameter representing a form name.
*** if (formCheck.name.value =="")
*** {
******* alert("Please provide your name:");*
******* formCheck.name.focus();
******* return false;
*** }

Can I use the same function threetimes?It only seems to work when I use the below function once.
function showPerc(freemade, freeatt){
percent = ((1*freemade) / (1*freeatt))*100;

message = "The pecent of "+freemade+" and "+freeatt+" is "+percent+".\n";

Any suggestions, Thanxs


Philip M
03-27-2005, 09:29 AM
You cannot have more than one function (or more than one global variable) with the same name.

Rename the second and third functions and variables xxx2, xxx3 nd so forth.