-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path2.html
More file actions
59 lines (55 loc) · 1.76 KB
/
Copy path2.html
File metadata and controls
59 lines (55 loc) · 1.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Arrays2</title>
</head>
<body>
<script>
var arr=new Array();
var rand;
document.write("<table style='border: double; background-color: azure; border-color: steelblue ; width: 30% '>");
for(var i=0; i<=4; i++){
arr[i]=new Array();
document.write("<tr style='border: dashed;border-color: steelblue;'>");
for(var j=0; j<=4; j++){
if(Math.random()>0.5){
document.write("<td style='border: dashed;border-color: steelblue; width: 6%'>");
arr[i][j]=Math.round(Math.random()*(-10)+1);
document.write(arr[i][j]);
document.write("</td>");
}
else
{ document.write("<td style='border: dashed;border-color: steelblue; width: 6%'>");
arr[i][j]=Math.round(Math.random()*10+1);
document.write(arr[i][j]);
document.write("</td>");
}
// document.write(arr[i][j]+" ");
}
document.write("</tr>");
//document.write("<br>");
}
document.write("</table>");
// document.write("<br>");
document.write("<table style='border: double; background-color: azure; border-color: steelblue; width: 30% '>");
for(var k=0; k<=4; k++){
document.write("<tr style='border: dashed;border-color: steelblue;'>");
for(var l=0; l<=4; l++) {
if((k==l)&&(arr[k][l]>0)){
arr[k][l]=1;
}
if((k==l)&&(arr[k][l]<0)){
arr[k][l]=0;
}
document.write("<td style='border: dashed;border-color: steelblue; width: 6%'>");
document.write(arr[k][l]+" ");
document.write("</td>");
}
document.write("</tr>");
document.write("<br>");
}
document.write("</table>");
</script>
</body>
</html>