-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.html
More file actions
52 lines (51 loc) · 1.67 KB
/
error.html
File metadata and controls
52 lines (51 loc) · 1.67 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
<html>
<head>
<title>Error Detection</title>
<link rel="icon" href="assets/binary1.ico">
<link rel="stylesheet" href="error.css">
</head>
<body>
<br>
<h1 style="color: aqua;">Error Detection</h1>
<br><br>
<div class="container">
<label>Enter Bits at Sender Side :</label>
<input type="text" placeholder="Enter the bits" id="Sender" autocomplete="off" required>
<br>
<br>
<label>Enter Bits at Reciever Side :</label>
<input type="text" placeholder="Enter the bits" id="receiver" autocomplete="off" required >
<br>
<br>
<button onclick="check();">Check</button>
<br>
</div>
<br><br><br><br><br><br><br>
<h1 id="demo" style="color:aqua"></h1>
<script>
function check(){
var input = document.getElementById("Sender").value;
var input1 = document.getElementById("receiver").value;
b="1"
c="0"
function digits_count(n){
var count = 0;
for(i=0;i<=n.length;i++){
if (n[i]==1)
++count;
}
x=count
}
console.log(digits_count(input));
if(x%2!=0)
result=input.concat(b)
else
result=input.concat(c)
if(input1===result)
document.getElementById("demo").innerHTML="There is no Error"
else
alert("There is Error")
}
</script>
</body>
</html>