简体   繁体   English

使用Java Applet在浏览器中滚动到顶部

[英]Scroll to Top inside the browser using Java Applet

I can not figure this one out. 我无法弄清楚这一点。 Is there anyway Java Applet can scroll the webpage that it's displayed to Top? 无论如何,Java Applet可以将显示的网页滚动到顶部吗?

I am Not talking about the scroll bar inside the Java Applet, I'm talking about browser's scroll bar. 我不是在谈论Java Applet内部的滚动条,而是在谈论浏览器的滚动条。

let's say I have very tall applet. 假设我有一个非常高的applet。 so browser has a scrollbar on the side to scroll down to bottom of the applet. 因此浏览器在侧面有一个滚动条,可以向下滚动到小程序的底部。

in the bottom, there's a button to click "Back To Top". 在底部,有一个按钮可以单击“返回顶部”。

How do I make that button work? 如何使该按钮起作用? Mind you that there is No scrollbar within the applet. 请注意,小程序内没有滚动条。

Thanks 谢谢

It is possible to call javascript code from within your applet. 可以从您的applet中调用javascript代码。 Thus create a jscript method which scrolls to the top and call it from your java code. 因此,创建一个jscript方法,该方法滚动到顶部并从Java代码中调用它。

More infos here . 更多信息在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM