-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
37 lines (26 loc) · 1.69 KB
/
script.js
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
function submitForm() {
var ERR=0;
var Fname = document.getElementById('Fname');
if (!Fname.value.length){FNE.className="error";FNE.innerHTML = "Cannot Be Blank"; Fname.className="fail"; ERR=1;}
else{FNE.className="confirm";FNE.innerHTML = "Success"; Fname.className="success";}
var Bday = document.getElementById('birthday');
if (!Bday.value.length){BDE.className="error";BDE.innerHTML = "Cannot Be Blank"; Bday.className="fail"; ERR=1;}
else{BDE.className="confirm";BDE.innerHTML = "Success"; Bday.className="success";}
var Email = document.getElementById('email');
if (!Email.value.length){EME.className="error";EME.innerHTML = "Cannot Be Blank"; Email.className="fail"; ERR=1;}
else {
if (Email.value.indexOf("@") === -1 || Email.value.indexOf(".") === -1 ){EME.className="error";EME.innerHTML = "Invalid Format"; Email.className="fail"; ERR=1;}
else{EME.className="confirm";EME.innerHTML = "Success"; Email.className="success";}
}
var Comm = document.getElementById('comment');
if (!Comm.value.length){COMME.className="error";COMME.innerHTML = "Cannot Be Blank"; Comm.className="fail"; ERR=1;}
else{COMME.className="confirm";COMME.innerHTML = "Success";Comm.className="success";}
if (ERR===0){CONF.className="contentbox";
fnameout.innerHTML = Fname.value;
birthout.innerHTML = Bday.Value;
EmailOut.innerHTML = Email.value;
commout.innerHTML = Comm.value;
MAIN.style.display = "none";
CONF.style.display = "block";
}
}