homepage Welcome to WebmasterWorld Guest from 54.163.91.250
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

    
Help with a validation function?
chornbeck




msg:3601648
 10:23 pm on Mar 15, 2008 (gmt 0)

Keeps failing - any suggestions?


function checkpass(field1,field2,alerttxt)
{
with (field1,field2)
{
if (Pass1.value != Pass2.value)
{alert(alerttxt);return false}
else {return true}
}
}

function validate_form(thisform)
{
with (thisform)
{

if (checkpass(Pass1,Pass2,"Passwords do not match!")==false)
{Pass1.focus();return false}
}
}

 

daveVk




msg:3601749
 1:03 am on Mar 16, 2008 (gmt 0)

function checkpass(Pass1,Pass2,alerttxt)
{
if (Pass1.value != Pass2.value)
{alert(alerttxt);return false}
else {return true}
}

Perhaps ?

In any case do away with the "with" statement

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