Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

281
Vistas
Changing variable count on html script

Everytime I click a button I try to add 1 to a count variable and that changes the iframe link to its selected number:

                const number = document.getElementsByClassName("nextepisode")
                const count = 1;
    
                number.addEve = function() {
                    count+= 2
                    number.innerHTML = count
                }
    
                <iframe id="iframe" src="https://www.2embed.ru/embed/tmdb/tv?id=1421&s=1&e=${count}" width="100%" height="100%" frameborder="0"></iframe>
    
                function prepareFrame () {
                    const ifrm = document.createElement("iframe")
                    ifrm.setAttribute("src", `https://www.2embed.ru/embed/tmdb/tv?id=1421&s=1&e=${count}`)
                    ifrm.style.width = "800"
                    ifrm.style.height = "600"
                    ifrm.allowFullscreen = true
                    ifrm.allow = "autoplay"
                    ifrm.scrolling = false
                    ifrm.frameBorder = "0"
                    document.body.appendChild(ifrm)
                }
    <body>
        <div style="text-align:center">
            <button><a class="nextepisode">Next Episode⏭</a></button>
    
        </div>
    </body>
    </html>

It just shows a blank screen, I'm kind of new to JavaScript so this may be something simple.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

const number = document.getElementById("nextepisode")
let count = 1;

const ifrm = document.createElement("iframe")
ifrm.setAttribute("src", `https://www.2embed.ru/embed/tmdb/tv?id=1421&s=1&e=${count}`)
ifrm.style.width = "800"
ifrm.style.height = "600"
ifrm.allowFullscreen = true
ifrm.allow = "autoplay"
ifrm.scrolling = false
ifrm.frameBorder = "0"
document.body.appendChild(ifrm)

function changeNumber() {
    count += 2
    ifrm.setAttribute("src", `https://www.2embed.ru/embed/tmdb/tv?id=1421&s=1&e=${count}`)
    console.log(number)
    number.innerHTML = count
}
<!DOCTYPE html>
<html>
  <head>
    <meta charset='utf-8'>
  </head>
  <div style="text-align:center">
    <button onClick='changeNumber()'>Next <span id="nextepisode"></span></button>
  </div>
</html>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda