Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

282
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda