-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.js
61 lines (50 loc) · 1.75 KB
/
action.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//create by EG
var sex, month, day, year, yearvalue, monthvalue, dayvalue, term;
function SetSex() {
sex = document.getElementById("sex");
sexvalue = sex.options[sex.selectedIndex].value;
if (sexvalue == 1) {
people = 'Уважаемая ';
} else if (sexvalue == 2) {
people = 'Уважаемый ';
}
return people;
}
function SetMonth() {
month = document.getElementById("month");
monthvalue = month.options[month.selectedIndex].value;
return monthvalue;
}
function SetDay() {
day = document.getElementById("day");
dayvalue = day.options[day.selectedIndex].value;
return dayvalue;
}
function SetYear() {
year = document.getElementById("year");
yearvalue = year.options[year.selectedIndex].value;
return yearvalue;
}
function FillForm(form) {
d0 = new Date(yearvalue, monthvalue, dayvalue);
d1 = new Date();
dt = ( d1.getTime() - d0.getTime() ) / (1000*60*60*24);
term = Math.round(dt);
var fail = false;
var fname = form.fname.value;
var lname = form.lname.value;
var email = form.email.value;
var pass = form.pass.value;
if (fname == "" || fname == " ")
fail = "Введите ваше имя";
else if (lname == "" || lname == " ")
fail = "Введите вашу фамилию";
else if (email == "" || email == " ")
fail = "Введите пожалуйста имейл";
if (pass == "" || pass == " ")
fail = "Введите пароль";
if (fail)
alert(fail);
else
alert("Здравствуйте "+people+""+fname+" "+lname+". \nВами установлен пароль "+pass+". \nСо времени Вашего рождения прошло "+term+" дней.");
}