Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <style>
- table {
- border-collapse: collapse;
- width: 100%;
- }
- th, td {
- border: 1px solid #dddddd;
- text-align: left;
- padding: 8px;
- width: 100px;
- min-width: 100px;
- max-width: 100px;
- }
- th {
- background-color: #f2f2f2;
- position: sticky;
- top: 0;
- }
- th:nth-child(1), td:nth-child(1){
- position: sticky;
- left: 0px;
- background-color: #f2f2f2;
- }
- th:nth-child(2), td:nth-child(2) {
- position: sticky;
- left: 100px;
- background-color: #f2f2f2;
- }
- #saveButton {
- margin-top: 10px;
- padding: 8px;
- }
- th:nth-child(1),
- th:nth-child(2){
- z-index: 1;
- }
- </style>
- <script>
- function saveData() {
- const table = document.getElementById('marksTable');
- const data = [];
- console.log(data);
- }
- </script>
- </head>
- <body>
- <table id="marksTable">
- <thead>
- <tr>
- <th>Student ID</th>
- <th>Student Name</th>
- <th>Subject 1</th>
- <th>Subject 2</th>
- <th>Subject 3</th>
- <th>Subject 4</th>
- <th>Subject 5</th>
- <th>Subject 6</th>
- <th>Subject 7</th>
- <th>Subject 8</th>
- <th>Subject 9</th>
- <th>Subject 10</th>
- <th>Total</th>
- </tr>
- </thead>
- <tbody>
- <!-- Sample data, you can dynamically generate rows as needed -->
- <tr>
- <td>1</td>
- <td>John Doe</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>250</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Jane Smith</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>258</td>
- </tr>
- <tr>
- <td>1</td>
- <td>John Doe</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>250</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Jane Smith</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>258</td>
- </tr>
- <tr>
- <td>1</td>
- <td>John Doe</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>250</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Jane Smith</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>258</td>
- </tr>
- <tr>
- <td>1</td>
- <td>John Doe</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>250</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Jane Smith</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>258</td>
- </tr>
- <tr>
- <td>1</td>
- <td>John Doe</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>250</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Jane Smith</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>258</td>
- </tr>
- <tr>
- <td>1</td>
- <td>John Doe</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>250</td>
- </tr>
- <tr>
- <td>2</td>
- <td>Jane Smith</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td contenteditable="true">10</td>
- <td>258</td>
- </tr>
- </tbody>
- </table>
- <button id="saveButton" onclick="saveData()">Save Data</button>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement