遇到错误:发生意外错误

时间:2012-08-15 08:31:08

标签: google-apps-script

我做了一些简单的代码测试来弄清楚这个Google-Apps-Script的工作原理。

现在我面临一条错误信息,我不知道是什么原因。一切都像我想要的那样工作,但运行代码以错误信息结束'遇到错误:发生意外错误'

我在网页上将此代码作为Apps-script-gadget运行。

请帮助初学者! : - )

这里是代码:

功能doGet(e) {

var app1 = UiApp.createApplication();  
app1.add(app1.loadComponent("Panel1")); //Panel1 made with UI-tool
var but1 = app1.getElementById("Button1");
var handler = app1.createServerClickHandler('func1');
but1.addClickHandler(handler);

return app1;

}

function func1(e) {

var app2 = UiApp.getActiveApplication();

app2.getElementById("TextBox1").setText("BigBrother");

return app2;

}

1 个答案:

答案 0 :(得分:1)

当将getElementById()用于没有ID的元素时,通常会发生这种情况...请在GUI构建器中检查TextBox1是否设置了具有正确值的ID。

编辑:这是一个屏幕截图。 enter image description here

并嵌入网站:

enter image description here

enter image description here

相关问题