【发布时间】:2021-09-10 23:58:51
【问题描述】:
我试图从智能电视中可视化一些 PDF,所以我将使用一些不可见的按钮来上下滚动文档。
所有这些,必须在网络上,这是我尝试过的:
JS:
<script>
function scrollUp(){
alert("funcion llamada UP");
window.scrollBy(0, -50);
}
function scrollDown(){
alert("funcion llamada DOWN");
document.getElementById('frame').contentWindow.scrollTo(10000,1000);
window.getElementById('frame').scrollTo(50000, 20);
//document.getElementById('frame').scrollTop = 438;
//window.scrollBy(0, 50);
}
window.onload=inicio;
function inicio(){
document.querySelector("#boton").onclick=scrollUp;
document.querySelector("#boton1").onclick=scrollDown;
}
PHP + HTML:
echo "<iframe src='$fichGG ' id='frame' class='frame' width=\"100%\" style=\"height:100%\"></iframe>";
警报有效,但 getElement 或 scrollBy 的所有选项都不起作用,不知道为什么。
谢谢大家。
【问题讨论】:
标签: javascript php html iframe