...

View Full Version : stats using form validation



pkeskey
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?



</SCRIPT><SCRIPT LANGUAGE="JavaScript1.2">
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";
alert(message);
}

Any suggestions, Thanxs

Paul

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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum