-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml.html
More file actions
155 lines (139 loc) · 5.04 KB
/
html.html
File metadata and controls
155 lines (139 loc) · 5.04 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Promedio de Notas</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Barlow:wght@300&family=Manrope:wght@200&display=swap"
rel="stylesheet">
<style>
body {
font-family: 'Barlow', sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
header {
background-color: #333;
color: white;
text-align: center;
padding: 1em;
}
.container {
max-width: 100%;
}
.row {
display: flex;
justify-content: space-between;
}
.col-6 {
width: 48%;
}
table {
width: 100%;
border-collapse: collapse;
border-radius: 15px;
overflow: hidden;
margin-top: 20px;
}
th, td {
padding: 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #333;
color: white;
}
@media screen and (max-width: 600px) {
table {
display: block;
width: 100%;
}
th, td {
display: block;
width: 100%;
box-sizing: border-box;
}
.col-6 {
width: 100%;
}
}
</style>
</head>
<body>
<header>
<h1>Promedio de Notas</h1>
</header>
<div class="container">
<div class="row">
<div class="col-6">
<strong>Nombre Alumno:</strong> Juan Perez
</div>
<div class="col-6">
<strong>Curso:</strong> Desarrollo Full Stack
</div>
</div>
</div>
<table>
<tr style="background-color: black;">
<th style="color: aliceblue;">Asignatura</th>
<th style="color: aliceblue;">Nota</th>
<th style="color: aliceblue;">Nota</th>
<th style="color: aliceblue;">Nota</th>
<th style="color: aliceblue;">Promedio</th>
</tr>
<tr>
<th>HTML</th>
<td><button onclick="agregarNota(this, 'Agrega la nota 1 de HTML: ')">Agregar nota</button></td>
<td><button onclick="agregarNota(this, 'Agrega la nota 2 de HTML: ')">Agregar nota</button></td>
<td><button onclick="agregarNota(this, 'Agrega la nota 3 de HTML: ')">Agregar nota</button></td>
<td></td>
</tr>
<tr>
<th>CSS</th>
<td><button onclick="agregarNota(this, 'Agrega la nota 1 de CSS: ')">Agregar nota</button></td>
<td><button onclick="agregarNota(this, 'Agrega la nota 2 de CSS: ')">Agregar nota</button></td>
<td><button onclick="agregarNota(this, 'Agrega la nota 3 de CSS: ')">Agregar nota</button></td>
<td></td>
</tr>
<tr>
<th>JAVASCRIPT</th>
<td><button onclick="agregarNota(this, 'Agrega la nota 1 de JavaScript: ')">Agregar nota</button></td>
<td><button onclick="agregarNota(this, 'Agrega la nota 2 de JavaScript: ')">Agregar nota</button></td>
<td><button onclick="agregarNota(this, 'Agrega la nota 3 de JavaScript: ')">Agregar nota</button></td>
<td></td>
</tr>
</table>
<script>
function agregarNota(button, mensajePersonalizado) {
var input = prompt(mensajePersonalizado);
var value = parseFloat(input);
if (!isNaN(value) && value >= 0 && value <= 7) {
var cell = button.parentNode;
cell.removeChild(button);
cell.textContent = value.toFixed(2);
var row = cell.parentNode;
var cells = row.cells;
var sum = 0;
var count = 0;
for (var i = 1; i < cells.length - 1; i++) {
var cellValue = parseFloat(cells[i].textContent);
if (!isNaN(cellValue)) {
sum += cellValue;
count++;
}
}
var average = sum / count;
cells[cells.length - 1].textContent = average.toFixed(2);
} else {
alert("Ingrese un valor numérico entre 0 y 7.");
}
}
</script>
</body>
</html>