Ik heb een tijdje gezocht op internet en heb een JavaScript gevonden die een formulier zou verzenden vanuit een homepage pagina.
Helaas wordt er niks verstuurt.
Klopt onderstaande code wel en hoe zou het anders wel moeten?
Helaas wordt er niks verstuurt.
Klopt onderstaande code wel en hoe zou het anders wel moeten?
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
| <!-- TWO STEPS TO INSTALL VALIDATION:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- 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>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<form name=form onSubmit="return checkFields();">
<input type=hidden name=to value='mijn@email.adres'>
<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> |