Kashub's Code Barn - "djdhdhebeb"

podświetlone jako text (dodał(a) jdudjdbej @ 2023-03-27 07:51:37)

Twoja wyszukiwarka
Podświetl ten kod w:
Ostatnio dodane:
Losowe wpisy:
<!DOCTYPE html>
<html>
<head>
    <title>Create Material Design Table on Click</title>
 
    <!-- Import Materialize CSS -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
 
    <!-- Import Material Icons -->
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
 
<button class="btn" onclick="createTable()">Create Table</button>
 
<div id="tableContainer"></div>
 
<script>
    function createTable() {
        var table = document.createElement('table');
        table.setAttribute('id', 'myTable');
        table.classList.add('striped');
 
        var thead = document.createElement('thead');
        var tr = document.createElement('tr');
        for (var i = 0; i < 3; i++) {
            var th = document.createElement('th');
            th.appendChild(document.createTextNode('Header ' + (i + 1)));
            tr.appendChild(th);
        }
        thead.appendChild(tr);
        table.appendChild(thead);
 
        var tbody = document.createElement('tbody');
        for (var i = 0; i < 3; i++) {
            var tr = document.createElement('tr');
            for (var j = 0; j < 3; j++) {
                var td = document.createElement('td');
                td.setAttribute('contenteditable', 'true');
                td.appendChild(document.createTextNode('Cell ' + (i + 1) + ',' + (j + 1)));
                tr.appendChild(td);
            }
            tbody.appendChild(tr);
        }
        table.appendChild(tbody);
 
        document.getElementById('tableContainer').appendChild(table);
 
        // Add a material design button
        var btn = document.createElement('button');
        btn.classList.add('btn', 'waves-effect', 'waves-light');
        btn.innerHTML = 'Save<i class="material-icons right">save</i>';
        document.getElementById('tableContainer').appendChild(btn);
    }
</script>
 
<!-- Import Materialize JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
 
</body>
</html>
| Sklepy internetowe | | Sklep z artykułami dla dzieci | | Opony całoroczne | | Opony letnie | | Kamery IP sklep | | Skróć link | | Blog o książkach | | Darmowe Blogi | | Przenieś bloga z onetu | | Kody programów |