ניסוי.html: הבדלים בין גרסאות בדף

מתוך ויקי נטפרי
קפיצה לניווט קפיצה לחיפוש
(ניסוי)
 
(נכשל)
תגית: ריקון
 
שורה 1: שורה 1:
<!DOCTYPE html>
 
<html lang="he">
 
<head>
 
  <meta charset="UTF-8">
 
  <title>הצגת פרמטרים</title>
 
  <style>
 
    body {
 
      font-family: Arial, sans-serif;
 
      direction: rtl;
 
      padding: 20px;
 
      background-color: #f9f9f9;
 
    }
 
    h1 {
 
      color: #333;
 
    }
 
    table {
 
      width: 50%;
 
      border-collapse: collapse;
 
      margin-top: 20px;
 
    }
 
    th, td {
 
      border: 1px solid #aaa;
 
      padding: 8px 12px;
 
      text-align: right;
 
    }
 
    th {
 
      background-color: #eee;
 
    }
 
  </style>
 
</head>
 
<body>
 
  <h1>פרמטרים מה-URL</h1>
 
  <table id="paramsTable">
 
    <tr>
 
      <th>פרמטר</th>
 
      <th>ערך</th>
 
    </tr>
 
  </table>
 
  
  <script>
 
    const params = new URLSearchParams(window.location.search);
 
    const table = document.getElementById('paramsTable');
 
 
    if ([...params].length === 0) {
 
      const row = table.insertRow();
 
      const cell = row.insertCell();
 
      cell.colSpan = 2;
 
      cell.textContent = "אין פרמטרים ב-URL";
 
    } else {
 
      params.forEach((value, key) => {
 
        const row = table.insertRow();
 
        const keyCell = row.insertCell();
 
        const valueCell = row.insertCell();
 
        keyCell.textContent = key;
 
        valueCell.textContent = value;
 
      });
 
    }
 
  </script>
 
</body>
 
</html>
 

גרסה אחרונה מ־14:44, 10 במרץ 2026