如何使用GWT从包含的javascript文件调用javascript函数?

如何使用GWT从包含的javascript文件调用javascript函数?,gwt,Gwt,我在添加到GWT模块的js文件中加载了一个函数 我试着用英语来称呼它 private static native void load() /*-{ $doc.Load(); }-*/; 但它给了我类似的错误 发生了错误!TypeError:$doc.Load不是函数文件名:行号:1224 我甚至试过用$wnd.Load 正确的称呼方式是什么?Igor是正确的。从主机HTML文件中考虑下面的代码片段: <html> <head> <meta htt

我在添加到GWT模块的js文件中加载了一个函数

我试着用英语来称呼它

private static native void load() /*-{
   $doc.Load();
}-*/;
但它给了我类似的错误

发生了错误!TypeError:$doc.Load不是函数文件名:行号:1224

我甚至试过用$wnd.Load


正确的称呼方式是什么?

Igor是正确的。从主机HTML文件中考虑下面的代码片段:

<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <link rel="stylesheet" type="text/css" href="resources/css/gxt-all.css" />
    <script language="JavaScript">
    function dostuff() {
        alert("Stuff is being done.");
    }
    </script>

    <!--                                                               -->
    <!-- Consider inlining CSS to reduce the number of requested files -->
    <!--                                                               -->
    <link type="text/css" rel="stylesheet" href="GxtSandbox.css">

显示此警报。

我添加到GWT模块是什么意思?您可以通过标记将js文件包含在主机页中,然后$wnd.Load引用就可以工作了。
public void onModuleLoad() {
    doGwtStuff();
}

public native void doGwtStuff() /*-{
    $wnd.dostuff();
}-*/;