-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
55 lines (44 loc) · 1.62 KB
/
demo.html
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
<head>
<link rel="stylesheet" type="text/css" href="uu.css">
<meta charset = "utf-8">
</head>
<!--above is just header-->
<!--input tab is a click onkeyup button calling function that checks if key is
"enter" key and if it is then it adds input to list-->
<input type="text" id="newtag" onkeyup="changeText2(event)">
<br>
<!-- list starts empty but onkeyup enter click we add li elements-->
<ol id="demo"></ol>
<script>
var list = document.getElementById('demo');
function changeText2(e) {
e.which = e.which || e.keyCode;
if(e.which == 13) {
var newtag = document.getElementById('newtag').value;
var entry = document.createElement('li');
var subject = document.createElement('button');
var user = document.createElement("img");
var up = document.createElement("button");
var down = document.createElement("button");
user.src = "https://scontent-lax3-1.xx.fbcdn.net/v/t1.0-9/15780931_1226914114013092_8130647129187188937_n.jpg?oh=22c85389f146787d4d702b5bb5698e81&oe=5A63E06B"
up.className = 'buttons-up'
down.className = 'buttons-down'
user.style.marginRight = "2em";
subject.style.marginRight = "2em";
up.style.marginRight = "2em";
down.style.marginRight = "2em";
subject.appendChild(document.createTextNode(newtag))
user.style.width = '4%';
user.style.height= 'auto';
user.onclick =
entry.appendChild(user);
entry.appendChild(subject)
entry.appendChild(up);
entry.appendChild(down);
list.appendChild(entry);
up.innerHTML = "up";
down.innerHTML = "down";
user.innerHTML = "user";
}
}
</script>