-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
127 lines (116 loc) · 3.41 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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Text Comparison</title>
<style>
/* Reset styles for HTML elements */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Styles for body element */
body {
font-family: Arial, sans-serif;
background-color: #333;
color: #f2f2f2;
padding: 20px;
display: flex;
flex-direction: column;
align-items: center;
}
/* Styles for link */
a {
text-decoration: none;
}
/* Styles for page header */
h1 {
font-size: 36px;
text-align: center;
margin-bottom: 20px;
color: #4CAF50;
}
/* Styles for form */
form {
background-color: #444;
padding: 20px;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
align-items: center;
}
/* Styles for labels and text fields */
label, textarea {
display: block;
font-size: 18px;
margin-bottom: 10px;
color: #f2f2f2;
}
textarea {
width: 100%;
width: 500px;
height: 200px;
padding: 10px;
border: 1px solid #888;
border-radius: 5px;
background-color: #555;
color: #f2f2f2;
resize: none;
}
/* Styles for button */
button {
background-color: #4CAF50;
color: #f2f2f2;
border: none;
border-radius: 5px;
font-size: 20px;
padding: 10px 20px;
cursor: pointer;
}
button:hover {
background-color: #3e8e41;
}
/* Styles for result */
.result {
font-size: 24px;
font-weight: bold;
margin-top: 20px;
text-align: center;
color: #f2f2f2;
}
.identical {
color: green;
}
.different {
color: red;
}
</style>
</head>
<body>
<a href="index.html"><h1>Text Comparison</h1></a>
<form>
<label for="text1">Text 1:</label>
<textarea id="text1"></textarea>
<label for="text2">Text 2:</label>
<textarea id="text2"></textarea>
<button type="button" onclick="compare()">Compare</button>
</form>
<div class="result" id="result"></div>
<script>
function compare() {
var text1 = document.getElementById("text1").value;
var text2 = document.getElementById("text2").value;
document.getElementById("result").classList.remove("identical", "different");
if (text1 === text2) {
document.getElementById("result").innerHTML = "The texts are identical";
document.getElementById("result").classList.add("identical");
} else {
document.getElementById("result").innerHTML = "The texts are different";
document.getElementById("result").classList.add("different");
}
}
</script>
</body>
</html>