每次單擊按鈕時,我都會嘗試將 1 添加到計數變數,并將 iframe 鏈接更改為其選定的數字:
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 有點陌生,所以這可能很簡單。
uj5u.com熱心網友回復:
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>
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/403616.html
標籤:
上一篇:Artifactory:如何通過curl命令將目錄(包含debian包)上傳到本地倉庫
下一篇:如何只訪問seccond引數?
