-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubstring.html
More file actions
51 lines (39 loc) · 1.37 KB
/
Copy pathSubstring.html
File metadata and controls
51 lines (39 loc) · 1.37 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Finding Substring</title>
</head>
<body>
<div id="Container">
<label for="str1">String 1 :</label><br>
<input type="text" id="str1" value="" required/><br><br>
<label for="str2">String 2 :</label><br>
<input type="text" id="str2" value="" required/><br><br>
<input type="button" value="Find" onclick="find()">
<input type="button" value="Reset" onclick="reset()"><br>
<h3><label id="result">Sub String :</label></h3>
</div>
<script>
function reset()
{
document.getElementById("str1").value = "";
document.getElementById("str2").value = "";
document.getElementById("result").innerHTML = "Sub String :";
}
function find()
{ //alert("working");
var text = document.getElementById("str1").value;
var result = text.includes(document.getElementById("str2").value);
if(result == true)
{
document.getElementById("result").innerHTML = "Sub String : Found";
}
else
{
document.getElementById("result").innerHTML = "Sub String : Not Found";
}
}
</script>
</body>
</html>