-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSArray.html
More file actions
50 lines (43 loc) · 1.19 KB
/
JSArray.html
File metadata and controls
50 lines (43 loc) · 1.19 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>
<title>JS.Array</title>
<script>
function myfunction (){
var x=prompt("Enter no. of people :\n");
var y=new Array(x);
var z=new Array(x);
var i=0;
var n=0;
var s;
for(i=0;i<x;i++)
{
if(i==0){s="st";}
else if(i==1){s="nd";}
else if(i==2){s="rd";}
else s="th";
y[i]=prompt("Enter name of "+(i+1)+s+" person :");
z[i]="<z style='color:blue;'>"+(i+1)+". Hello <i><u>"+y[i]+"</u></i> </z><br/>";
}
for(i=1;i<x;i++)
{
z[i]=z[i-1]+z[i];
}
document.getElementById("h").innerHTML="<center>"+z[x-1]+"</center>";
document.getElementById("g").style.display="none";
document.getElementById("j").style.display="block";
document.getElementById("g2").style.display="none";
document.getElementById("j2").style.display="block";
}
</script>
</head>
<body>
<center>
<h1 style="color:red;" id="g">Enter People Name :<br/></h1>
<h1 style="color:red;display:none;" id="j">The List Of People Are :<br/></h1>
<p id="g2"><button onclick="myfunction()" style="background-color:lightblue;">enter here</button></p>
<p style="display:none;" id="j2"><button onclick="myfunction()" style="background-color:lightblue;">click to re-enter</button></p>
<br/>
<div id="h"></div>
</center>
</body>
</html>