Error: return statement, HELP!

admin

Administrator
Staff member
Below is my script. The error is coming from this portion of my script - return false

if(document.myForm.address.value==""){
alert("Please enter your address!")
document.myForm.address.focus()
return false


<script language="JavaScript" type="text/javascript">
<!--

function myValid(){
if(document.myForm.first_name.value==""){
alert("Please enter your first name!")
document.myForm.first_name.focus()
return false
}
if(document.myForm.last_name.value==""){
alert("Please enter your last name!")
document.myForm.last_name.focus()
return false
}
if(document.myForm.company.value==""){
alert("Please enter your company's name!")
document.myForm.company.focus()
return false
}
if(document.myForm.professional_title.value==""){
alert("Please enter your professional title!")
document.myForm.professional_title.focus()
return false
}

re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/

if(re.test(myForm.emailAddress.value)){
return true
}
alert("Invalid email address!")
myForm.emailAddress.focus()
myForm.emailAddress.select()
return false
}
if(document.myForm.address.value==""){
alert("Please enter your address!")
document.myForm.address.focus()
return false
}
if(document.myForm.city.value==""){
alert("Please enter your city!")
document.myForm.city.focus()
return false
}
return true
}

//-->
</script>
 
Back
Top