Javascript 使用GAS在运行时调整HTML模式的大小
我有一个显示html表单的模式。表单有一个按钮。 Modal最初设置为600x425的宽度。然后,在运行期间,如果按下按钮,则应将模式大小从600x425调整为300x200 如何使用谷歌应用程序脚本获取此信息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()
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);
}