更改 html 脚本的变量计数

Changing variable count on html script

每次我单击一个按钮时,我都会尝试将 1 添加到计数变量,这会将 iframe link 更改为其选定的数字:

                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>

它只是显示一个空白屏幕,我是 JavaScript 的新手,所以这可能很简单。

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>