Forum Moderators: open
It's probably worth mentioning that - just for the purposes of code clarity/efficiency - you could set a local variable at the top of the function,
var elements = document.friendform.elements Also, if you are dealing with modern browsers only,
document.getElementsByName("friend_email") will give you a collection of all of them.