Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

283
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!