Script Categories













Forms >>> Validation.

Let Javascript help you receive feedback from your visitors. The script also requires that all fields must be completed before the form is submitted.

Name:      

E-mail:    

Web Site:  

Comments:




Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
function checkFields() {
missinginfo = "";
if (document.form.name.value == "") {
missinginfo += "\n     -  Name";
}
if ((document.form.from.value == "") ||
(
document.form.from.value.indexOf('@') == -1) ||
(
document.form.from.value.indexOf('.') == -1)) {
missinginfo += "\n     -  Email address";
}
if ((document.form.website.value == "") ||
(
document.form.website.value.indexOf("http://") == -1) ||
(
document.form.website.value.indexOf(".") == -1)) {
missinginfo += "\n     -  Web site";
}
if(document.form.comments.value == "") {
missinginfo += "\n     -  Comments";
}

if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in your:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}
//  End -->
</script>
<form name=form onSubmit="return checkFields();">

<input
type=hidden name=to value='you @ your domain . web'>
<input
type=hidden name=subject value="Freedback">

<pre>
Name:      <input type=text name="name" size=30>

E-mail:    <input type=text name="from" size=30>

Web Site:  <input type=text value="http://" name="website" size=30>

Comments:

<textarea rows=3 cols=40 name="comments"></textarea>

<input
type=submit name="submit" value="Submit Form!">
</pre>
</form>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).

http://www.cashadvance-loans.net/alabama/cash-advance-montgomery-al/ . Bitcoin Gambling - The Original Crypto Dice Game


©