homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Whats wrong with this Javascript?
Syntax probs

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

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

function Check()
z = document.PersonalChange;

if ((z.EmployeeName.value == "") ¦¦ (z.PayrollNumber.value == ""));
alert('You need to enter your name');
return false;
return true;

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



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

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


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

*ahem* Thanks bob!

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


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

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

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved