I have some html that I put into an HTML flow which contains javascript. When I attempt to call the function on a Window that contains the HTMLFlow, I see the following exception:
Uncaught JavaScript exception [foo is not defined] in http://localhost:8080/gsui/?gwt.codesvr=127.0.0.1:9997, line 1
Reading the documentation, I see that using setEvalScriptBlocks(true) evalutes script blocks so that the HTML functions like a normal HTML page would?
What am I doing wrong?
Uncaught JavaScript exception [foo is not defined] in http://localhost:8080/gsui/?gwt.codesvr=127.0.0.1:9997, line 1
Reading the documentation, I see that using setEvalScriptBlocks(true) evalutes script blocks so that the HTML functions like a normal HTML page would?
What am I doing wrong?
Code:
public class Page extends HTMLFlow { public Page() { super(); doLayout(); } private void doLayout() { String html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n" + "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n" + "<head>\n" + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n" + "<script type=\"text/javascript\">\n" + "\tfunction foo()\n" + "\t{\n" + "\t\talert('foo');\n" + "\t}\n" + "</script>\n" + "<title>Untitled Document</title>\n" + "</head>\n" + "\n" + "<body>\n" + "<input type=\"button\" onclick=\"foo();\" value=\"Shoot\"/>\n" + "</body>\n" + "</html>\n"; setEvalScriptBlocks(true); setContents(html); setContentsType(ContentsType.PAGE); } }
Comment