-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmovies.js
88 lines (78 loc) · 2.72 KB
/
movies.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
let c="c";
let m="m";
function add(l) {
if (! document.querySelector("form")){
let form = document.createElement("form");
form.method='post';
let divka = document.getElementById("addmovie");
divka.classList.add("addmovie");
console.log("yes");
let name = document.createElement("input");
name.type = "text";
name.name = "name";
name.required = true;
let date = document.createElement("input");
date.type = "text";
date.name = "date";
date.required = true;
let img = document.createElement("textarea");
img.rows="2";
img.cols="30";
img.name = "img";
img.required = true;
let about = document.createElement("textarea");
about.rows="10";
about.cols="30";
about.name = "about";
about.required = true;
let submit = document.createElement("input");
submit.type = "submit";
submit.value="Add";
if (l==="m"){
form.action='movies.php';
var label = document.createElement("label");
label.innerHTML="PHASE";
var phase = document.createElement("select");
let o1 = document.createElement("option");
o1.value="1";
o1.innerHTML="1";
let o2 = document.createElement("option");
o2.value="2";
o2.innerHTML="2";
let o3 = document.createElement("option");
o3.value="3";
o3.innerHTML="3";
phase.appendChild(o1);
phase.appendChild(o2);
phase.appendChild(o3);
phase.name = "phase";
phase.required = true;
name.placeholder = "Name of the film";
date.placeholder = "DD Month YYYY of premier";
img.placeholder = "URL of poster";
about.placeholder = "About the movie";
form.appendChild(label);
form.appendChild(phase);
}
else {
form.action='characters.php';
let page = document.createElement("textarea");
page.rows="2";
page.cols="30";
page.name = "img";
page.required = true;
name.placeholder = "Character's name";
date.placeholder = "First mention of character";
img.placeholder = "URL of his picture";
page.placeholder="URL of it's web page";
about.placeholder = "couple words about the character";
form.appendChild(page);
}
form.appendChild(name);
form.appendChild(date);
form.appendChild(img);
form.appendChild(about);
form.appendChild(submit);
divka.appendChild(form);
}
}