[英]'showPDF' is declared but its value is never read
some background information: i have a button in my html file that should activate the showPDF function but it tells me that its value is never read一些背景信息:我的 html 文件中有一个按钮,它应该激活 showPDF function 但它告诉我它的值永远不会被读取
javascript: 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);
}
},
};
the button in my html looks like this:我的 html 中的按钮如下所示:
<button type="button" id="show" onclick="showPDF(this)" >PDF anzeigen</button>
help would be greatly appreciated as i can't seem to find any answers in different questions非常感谢您的帮助,因为我似乎无法在不同的问题中找到任何答案
You just need to remove the duplication of the showPDF
function.您只需要删除
showPDF
function 的重复项。 you don't need the inner one.你不需要内在的。
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.