Hello i am trying to embed a collection of pdf in a in a web page, i got the name to work but when i click on it, i get a
Blank square, does anyone see anything wrong with my code ?
Thanks !
$dir = "C:\inetpub\wwwroot\Docs\Manuals\Honda"; // Change this to the directory containing the PDF files
$files = scandir($dir);
foreach ($files as $file) {
if (substr($file, -4) == ".pdf") {
$filename = substr($file, 0, -4);
echo "<button class=\"collapsible\">$filename</button>";
echo "<div class=\"content\">";
echo "<embed src=\"$dir/$file\" width=\"100%\" height=\"500\">";
echo "</div>";
}
}
?>
<script>
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll.addEventListener("click", function() {
this.classList.toggle("active");
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
});
}
</script>