A Feedback Form - JxPharmacy - Doc JavaScript | 2 | WebReference

A Feedback Form - JxPharmacy - Doc JavaScript | 2

Code (A Feedback Form)

<SCRIPT LANGUAGE="JavaScript">
<!--
// Copyright (c) 2000 internet.com Corp. 
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.
function valid(form) {
  var field = form.email;
  var str = field.value;
  if (window.RegExp) {
    var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
    var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
    var reg1 = new RegExp(reg1str);
    var reg2 = new RegExp(reg2str);
    if (!reg1.test(str) && reg2.test(str))
      return true;
    field.focus();
    field.select();
    return false;
  } else {
    if(str.indexOf("@") >= 0)
      return true;
    field.focus();
    field.select();
    return false;
  }
}
// -->
</SCRIPT>
<FORM METHOD="POST"
      ACTION="mailto:you@yourdomain.com"
      ENCTYPE="text/plain"
      onSubmit="return valid(this)">
Your e-mail address:<BR><INPUT TYPE="text" NAME="email" SIZE="40"><BR>
Subject:<BR><INPUT TYPE="text" NAME="subject" SIZE="40"><BR>
Comments:<BR><TEXTAREA NAME="comments" COLS="40" ROWS="5"></TEXTAREA><BR>
<INPUT TYPE="submit" VALUE="Send Mail">
</FORM>

http://www.internet.com

Created: November 6, 1997
Revised: December 4, 1997
URL: http://www.webreference.com/js/pharmacy/formcode.html