[英]'showPDF' is declared but its value is never read
一些背景信息:我的 html 文件中有一個按鈕,它應該激活 showPDF function 但它告訴我它的值永遠不會被讀取
javascript:
HM.PDFViewer =
{
init: function()
{
//---
},
showPDF: function()
{
function showPDF(x) {
x.style.display = "none";
var embed = document.createElement("EMBED");
embed.setAttribute("src", "/pdf/Doku.pdf");
embed.classList.add("size");
document.body.appendChild(embed);
}
},
};
我的 html 中的按鈕如下所示:
<button type="button" id="show" onclick="showPDF(this)" >PDF anzeigen</button>
非常感謝您的幫助,因為我似乎無法在不同的問題中找到任何答案
您只需要刪除showPDF
function 的重復項。 你不需要內在的。
showPDF: function()
{
x.style.display = "none";
var embed = document.createElement("EMBED");
embed.setAttribute("src", "/pdf/Doku.pdf");
embed.classList.add("size");
document.body.appendChild(embed);
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.