-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhide-text.html
More file actions
84 lines (77 loc) · 1.86 KB
/
hide-text.html
File metadata and controls
84 lines (77 loc) · 1.86 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Hide a secret text message inside a text message</title>
</head>
<body>
<div>
<label for="publicText">Public text</label>
<textarea id="publicText" cols="30" rows="10"></textarea>
<label for="secretText">Secret text</label>
<textarea id="secretText" cols="30" rows="10"></textarea>
<input type="button" value="hide" onclick="hide_click()" />
<input type="button" value="unhide" onclick="unhide_click()" />
<br />
<label for="result">Result</label>
<textarea id="result" cols="30" rows="10"></textarea>
</div>
<style>
input[type=button] {
width: 100px;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 10px 10px;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=button]:hover {
background-color: #45a049;
}
textarea {
width: 100%;
height: 150px;
padding: 12px 20px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
background-color: #f8f8f8;
resize: none;
}
div {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
</style>
<script>var in_browser = true;</script>
<script src="./hide-text.js"></script>
<script>
function hide_click() {
result.value = "";
if (publicText.value.length == 0) {
publicText.focus();
return;
}
if (secretText.value.length == 0) {
secretText.focus();
return;
}
result.value = hide_text(publicText.value, secretText.value);
}
function unhide_click() {
publicText.value = '';
secretText.value = '';
if (result.value.length == 0) {
result.focus();
return;
}
secretText.value = unhide_text(result.value);
}
</script>
</body>
</html>