-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
54 lines (49 loc) · 1.4 KB
/
index.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
<!DOCTYPE html>
<html>
<!-- Links For CSS Files -->
<!-- Bootstrap (used only for container div) -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<!-- RandomCode CSS Stylesheet -->
<link rel = "stylesheet" type="text/css" href="resources/css/stylesheet.css">
<title>Random Code JS - Paragraph Stuff</title>
<body>
<div="container">
<center>
<h2>Random Code JS - Adding To A Paragraph</h2>
<br><br>
<p id="controls">
<button onclick = "controls(false, 'add')">Add To Paragraph</button>
<button onclick = "controls(false, 'replace')">Replace Paragraph's Content</button>
<button onclick = "controls(false, 'remove')">Clear Paragraph</button>
</p>
<p id="para"></p>
</center>
<script>
let p = document.getElementById("para");
/*
Controls function:
censor: if the censor is on or off
control: what should be done (clear, replace, etc)
*/
function controls(censor, control) {
let text = "";
switch (control){
case "add":
text = prompt("Text:");
p.innerHTML += text;
break;
case "replace":
text = prompt("Text:");
p.innerHTML = text;
break;
case "remove":
p.innerHTML = "";
break;
default:
break;
}
}
</script>
</div>
</body>
</html>