首页 > 解决方案 > 带有链接的消息框

问题描述

我正在尝试popup a message box在带有文本和clickable hyperlink.

到目前为止,我的搜索产生了已弃用的 ui 功能。

标签: google-apps-scriptweb-applications

解决方案


function msgBoxWithLink(msg,link,desc) {
  var link=link || 'http://jimesteban.com';
  var desc=desc || 'Description';
  var msg=msg || 'Link';
  var html=Utilities.formatString('<style>input{margin: 5px 0;}</style><h3>%s</h3><a href="%s" target="_blank">%s</a><br /><input type="button" value="Close" onClick="google.script.host.close();" />',msg,link,desc);
  var userInterface=HtmlService.createHtmlOutput(html);
  SpreadsheetApp.getUi().showModelessDialog(userInterface, "Message Box with Link");
}

推荐阅读