http://libro.tuyano.com/index3?id=645006&page=4「新しくWebアプリケーション用の機能が追加された」といっても、スクリプトの基本は従来と同じです。doGet関数を定義し、そこでGETでアクセスされた際の出力内容を作成します。サンプルスクリプトで行なっているのは、ラベルとボタンからなる簡単なGUIをスクリプトで作成するものです。スクリプトによるGUIの作成は以下で説明してあります。
http://libro.tuyano.com/index3?id=647004
※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
// Script-as-app template.
function doGet() {
var app = UiApp.createApplication();
var button = app.createButton('Click Me');
app.add(button);
var label = app.createLabel('The button was clicked.')
.setId('statusLabel')
.setVisible(false);
app.add(label);
var handler = app.createServerHandler('myClickHandler');
handler.addCallbackElement(label);
button.addClickHandler(handler);
return app;
}
function myClickHandler(e) {
var app = UiApp.getActiveApplication();
var label = app.getElementById('statusLabel');
label.setVisible(true);
app.close();
return app;
}
| << 前へ | 次へ >> |