0
الإعداد الفردية
كيف اعمل HTML code يساعدني في انشاء جدول لجميع الإعداد الفردية من 1-90
2 Respostas
+ 2
To achieve looping functionality from 1 to 90 in HTML, you typically employ JavaScript. HTML itself doesn't inherently support looping mechanisms, unless each element is hard-coded individually, which is generally not recommended due to its inefficiency and lack of scalability.
<!DOCTYPE html>
<head>
<style>
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid black;
padding: 8px;
text-align: center;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Number</th>
</tr>
</thead>
<tbody id="numberTable">
<!-- اظهار الأعداد بإساتخدام ال HTML -->
</tbody>
</table>
<script>
// الأعداد الفردية من 1 الى 90
function generateNumbers() {
var tableBody = document.getElementById("numberTable");
for (var i = 1; i <= 90; i++) {
var row = document.createElement("tr");
var cell = document.createElement("td");
cell.textContent = i;
row.appendChild(cell);
tableBody.appendChild(row);
}
}
// مناداة وظيفة generateNumbers ()
window.onload = generateNumbers;
</script>
</body>
</html>
+ 1
Attempts
محاولات