Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用GAS在运行时调整HTML模式的大小_Javascript_Html_Google Apps Script_Google Sheets - Fatal编程技术网

Javascript 使用GAS在运行时调整HTML模式的大小

Javascript 使用GAS在运行时调整HTML模式的大小,javascript,html,google-apps-script,google-sheets,Javascript,Html,Google Apps Script,Google Sheets,我有一个显示html表单的模式。表单有一个按钮。 Modal最初设置为600x425的宽度。然后,在运行期间,如果按下按钮,则应将模式大小从600x425调整为300x200 如何使用谷歌应用程序脚本获取此信息 function showPickerImages() { var html = HtmlService .createTemplateFromFile("MyHTMLForm") .evaluate()

我有一个显示html表单的模式。表单有一个按钮。 Modal最初设置为600x425的宽度。然后,在运行期间,如果按下按钮,则应将模式大小从600x425调整为300x200

如何使用谷歌应用程序脚本获取此信息

function showPickerImages() {

        var html = HtmlService
            .createTemplateFromFile("MyHTMLForm")
            .evaluate()
            .addMetaTag("viewport", "width=device-width, initial-scale=1")
            .setWidth(600)
            .setHeight(425)
            .setTitle("Resize demo")
            .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
        SpreadsheetApp.getUi().showModalDialog(html, 'demo');
}
MyHTMLForm.html

<button onclick="resizeModalDialog()"></button>

使用和:

// resize modal window
function resizeModalDialog()
{
  google.script.host.setWidth(300);
  google.script.host.setHeight(200);
}