Borrador.html 1.38 KB
<html>



<body>
    <input type="number" id="CantBotones"> 
    <button onclick="AgregarTabs()">Generar Tabs</button>
    <section id="BotonesContainer" >
   

    </section>
</body>

<script>
    function AgregarTabs() {
        let m = document.getElementById("CantBotones").value;
        let n;
        for (n = 0; n < m; n++) {
            let padre = document.getElementById("BotonesContainer");
            let boton = document.createElement("Button");
            padre.appendChild(boton);
            
            
            boton.setAttribute("id", "Boton" + n);
            boton.setAttribute("class", "Botones");
            boton.addEventListener("click", HabilitarTab);
            boton.style.width = ((100-(0.2*m))/ m) + "%";
        }
    }
    function HabilitarTab(){

    }
</script>
<style>
        #BotonesContainer {
            width: 100%;
            height: 95%;
        }
    
        .Botones {
            border-radius: 5px 5px 0px 0px;
            background-color: grey;
            border:none;
            height: 5%;
            margin: 0.1%;
        }
        .Botones:active{
            background-color: whitesmoke;
            border-bottom: none;
            height: 6%;
            border: 1px solid rgb(189, 189, 189);
            border-bottom: none;
        }
        .Botones:hover{
            background-color: rgb(53,53,53), 0.5;
        }
    </style>

</html>