-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
49 lines (45 loc) · 1.12 KB
/
index.html
File metadata and controls
49 lines (45 loc) · 1.12 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
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style>
.center {
margin: auto;
width: 60%;
border: 3px solid #73AD21;
padding: 10px;
margin-top: 20%;
}
h3{
text-align: center;
}
.form-inline{
margin-left: 17%;
}
</style>
</head>
<body>
<div class="center">
<h3> Number of occurrences of substring in given string.</h3>
<br><br>
<form class="form-inline">
<div class="form-group">
<input type="text" class="form-control" id="string" placeholder="String">
</div>
<div class="form-group">
<input type="text" class="form-control" id="substring" placeholder="SubString">
</div>
<button onclick="myFunction4()" type="button" class="btn btn-success">Output</button>
<br><br>
No. of Occurences: <p id="result"></p>
</form>
</div>
<script type="text/javascript" >
function myFunction4(){
var x=document.getElementById("string").value;
var y=document.getElementById("substring").value;
var output=((x.split(y).length)-1);
document.getElementById("result").innerHTML=output;
}
</script>
</body>
</html>