Welcome to WebmasterWorld Guest from 54.226.32.234

Forum Moderators: open

Message Too Old, No Replies

Whats wrong with this Javascript?

Syntax probs

     

knighty

5:15 pm on Oct 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Someone please explain - why do I get a syntax error for the line where the else statement is?

just a simple script to check if a couple form fields are empty

<script>
function Check()
{
z = document.PersonalChange;

if ((z.EmployeeName.value == "") ¦¦ (z.PayrollNumber.value == ""));
{
alert('You need to enter your name');
return false;
}
else
{
alert('woohoo');
return true;
}
}
</script>

--for the form I have....

<form method=post action="success.html" name="PersonalChange" onSubmit="return Check();">

but i get an error before I get a chance to execute the form

bobriggs

5:21 pm on Oct 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



remove the semicolon at the end of this line:
if ((z.EmployeeName.value == "") (z.PayrollNumber.value == ""));

knighty

9:13 am on Oct 31, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




*ahem* Thanks bob!

I KNEW it would be something like that, normally dont put enough in ;)

g1smd

10:16 pm on Oct 31, 2002 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



<script> should be :
<script language="javascript" type="type/javascript"> if you want it to validate.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month