HighDots Forums  

Javascript Errors

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss Javascript Errors in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark Sargent
 
Posts: n/a

Default Javascript Errors - 08-20-2004 , 02:15 PM






Hi All,

what's wrong with this code..? After entering the code where I create
invalid characters, after the 4th return false, any code put into the page
after it, and including it, doesn't work. Little lost. Cheers.

P.S. Am studying Javascript and got this sample from a book, although, a
little different than the book's code.

downdogWoof...

<script language = "Javascript" type = "text/javascript">
<!-- Hide
function validEmail(memForm) {
if (memForm.memPassword.value == "") {
alert("You must enter a password")
memForm.memPassword.focus()
memForm.memPassword.select()
return false
}
if (memForm.memPassword.value != memForm.memPassword2.value) {
alert("Please make sure your password matches")
memForm.memPassword.focus()
memForm.memPassword.select()
return false
}
if(memForm.memUsername.value == "") {
alert("Please enter a Username")
memForm.memUsername.focus()
memForm.memUsername.select()
return false
}
if(memForm.memEmail.value=="") {
alert("Please enter an Email address")
memForm.memEmail.focus()
memForm.memEmail.select()
return false
}
var invalidChar="/;:@" //Invalid Character code
for(i=0;i<invalidChar.length;i++) {
var badChar=invalidChar.charAt(i)
if(memForm.memEmail.indexOf(badChar,0)>-1) {
alert("Your email contains bad cahracters, please try again")
memForm.memEmail.focus()
memForm.memEmail.select()
return false
}
}
if(memForm.memFName.value=="") { //this code also didn't work after
entering below the invalid character code above
alert("Please enter your 1st name")
memForm.memFName.focus()
memForm.memFName.select()
return false
}
return true
}
// End Hiding Script-->
</script>



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.