Borrador.html
2.09 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
<html>
<body>
    <input type="number" id="CantBotones">
    <button onclick="AgregarTabs()">Generar Tabs</button>
    <section id="BotonesContainer">
    </section>
    <section id="TabsContainer">
    </section>
</body>
<script>
    function AgregarTabs() {
        let m = document.getElementById("CantBotones").value;
        let n;
        for (n = 0; n < m; n++) {
            let padreBotones = document.getElementById("BotonesContainer");
            let padreTabs = document.getElementById("TabsContainer");
            let boton = document.createElement("Button");
            padreBotones.appendChild(boton);
            boton.setAttribute("id", "Boton" + n);
            boton.setAttribute("value", n);
            boton.setAttribute("class", "Botones");
            boton.addEventListener("click", HabilitarTab);
            let ancho = ((100 - (0.2 * m)) / m) + "%";
            boton.style.width = ancho;
            let tab = document.createElement("div");
            padreTabs.appendChild(tab);
            tab.style.width=ancho * m;
            tab.setAttribute("id", "Tab" + n);
            tab.setAttribute("class", "Tabs");
        }
        document.getElementById("Tab0").style.display="block";
    }
    function HabilitarTab() {
        for (n = 0; n < m; n++) {
           document.getElementById("Tab" + n).style.display="none"
            if(doc){}
        }
        
    }
</script>
<style>
    html {
        --Color: rgb(122, 230, 163);
    }
    #BotonesContainer {
        width: 100%;
        height: 5%;
    }
    #TabsContainer {
        width: 100%;
        height: 95%;
    }
    .Botones {
        border-radius: 5px 5px 0px 0px;
        background-color: rgb(168, 168, 168);
        border: none;
        height: 100%;
        margin: 0.1%;
    }
    .Botones:active {
        background-color: var(--Color);
        border-bottom: none;
        height: 6%;
        border-bottom: none;
    }
    .Botones:hover {
        background-color: rgb(53, 53, 53), 0.5;
    }
    .Tabs {
        display: none;
        height: 100%;
        border: 3px solid var(--Color);
    }
</style>
</html>