|
if(name = getCookie("name")) document.contact.name.value = name;
It is never a a good idea to use the same name for an HTML form element and a Javascript variable.
setCookie("email", contact.email.value);
should be
setCookie("email", document.contact.email.value);
But you are trying to use mailto: as the form action. The trouble with using this long-obsolete method (mailto) to send form results is its unpredictability. The method it is highly dependent on the browser in use and the email client in use (some people have only Yahoo, Gmail or Hotmail). In particular, your visitor must have Outlook or Outlook Express or Windows Live Mail as the default client for this to work correctly. Even if your visitor is using Internet Explorer, but the default mail client is different (e.g. Eudora or Thunderbird), your mailto form will not work. With all of the browser troubles, you're likely to lose about half of your users' messages. Most of the email clients that can successfully send a mail will prompt the user with a somewhat threatening security dialog prior to sending - this can scare many users from continuing. Other users will not wish to reveal their email address. Also, what about people with Javascript disabled?
In addition, if you place an unobfuscated email address in your webpage, the bots will quickly find it and inundate you in spam.
Modern browsers no longer accept mailto: as a form action - they simply open the email program (if any) and ignore the form. If you are going to use a form then use a server-side CGI formmail script as the action - there are several good free ones out there.
"...there are indications that the severest phase of the recession is over..."
- Harvard Economic Society (HES) Jan 18, 1930
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
|