-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4.html
More file actions
86 lines (83 loc) · 3.76 KB
/
4.html
File metadata and controls
86 lines (83 loc) · 3.76 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
85
86
<html>
<head>
<title>
4th Page...
</title>
</head>
<style type="text/css">
body
{
background:#78c4c7;
background-size: cover;
background-attachment: fixed;
text-align:center;
}
</style>
<body>
<form name=str3 action="">
<h1><u>Printing a substring from original string (substr function) </u></h1>
<br>
<input type="label" id="l1" value="Enter Your String"> =<input type="text" id="box1"><br>
<br>
<input type="button" id="last" value="Print LastIndex" onclick="lastindex()"> = <input type="text" id="box2"><br>
<br>
<b>Enter starting index: </b> =<input type="text" id="box3"><br>
<br>
<b>No of Characters to be printed from starting index: </b> =<input type="text" id="box4"><br>
<br>
<br>
<input type="button" id="Create" value="Print" onclick="substr()"> <input type="Reset" id="re4" value="Reset" onclick="document.forms.str3.reset()/">
<br>
<br>
<b>Substring is :</b> <input type="text" id="box5"><br>
<b><hr></b>
<b><hr></b>
<h1><u>Printing a substring between starting & ending index (substring function) </u></h1>
<input type="label" id="l2" value="Enter Your String"> =<input type="text" id="box6"><br>
<br>
<b><u>Enter Starting index:</u></b> <input type="text" id="box7"><br>
<br>
<b><u>Enter Ending index:</u></b> <input type="text" id="box8"><br>
<br>
<input type="button" id="Create1" value="Print" onclick="substring()"> <input type="Reset" id="re5" value="Reset" onclick="document.forms.str3.reset()/">
<br>
<br>
<b>Substring is:</b> <input type="text" id="box9"><br>
<br>
<b><hr></b>
<input type="button" id="btnpre1" value="Previous Page" onclick="previous()"> <input type="button" id="btnnx1" value="Next Page" onclick="next()">
</form>
<script>
function lastindex()
{
var g=document.getElementById("box1").value
var e=g.length-1;
document.getElementById("box2").value=e
}
function substr()
{
var a=document.getElementById("box1").value
var b=document.getElementById("box3").value
var c=document.getElementById("box4").value
var d=a.substr(b,c);
document.getElementById("box5").value=d
}
function substring()
{
var x=document.getElementById("box6").value
var y=document.getElementById("box7").value
var z=document.getElementById("box8").value
var k=x.substring(y,z);
document.getElementById("box9").value=k
}
function previous()
{
document.location.href="3.html";
}
function next()
{
document.location.href="5.html";
}
</script>
</body>
</html>