0

我尝试 使用 gwt jsni从此链接https://stackoverflow.com/a/9100406/942113调用代码。

我的方法看起来像

  public static native void hideAddressBar() /*-{
        if (document.documentElement.scrollHeight < $wnd.outerHeight * $wnd.devicePixelRatio) {
            document.documentElement.style.height = ($wnd.outerHeight * $wnd.devicePixelRatio) + 'px';
        }
        setTimeout($wnd.scrollTo(1, 1), 0);
  }-*/;

但是当我调用它时,什么也没有发生。

我的问题:不能document.documentElement.style.height用 gwt jsni 设置值吗?

4

1 回答 1

5

尝试将其称为$doc而不是document

参考:http ://code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html

于 2012-02-22T21:22:41.027 回答