Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/http/4.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
Google apps script 谷歌表单+;应用程序脚本将更多链接定位添加到对话框_Google Apps Script_Google Sheets - Fatal编程技术网

Google apps script 谷歌表单+;应用程序脚本将更多链接定位添加到对话框

Google apps script 谷歌表单+;应用程序脚本将更多链接定位添加到对话框,google-apps-script,google-sheets,Google Apps Script,Google Sheets,嗨,如果我想在这个对话框中添加更多的链接,那么我该怎么做呢?我尝试了多种方法,但都没有成功 function Links(){ showAnchor('Link','http://LINK IN HERE'); } function showAnchor(name,url) { var html = '<html><body><a href="'+url+'" target="blank" onclick="

嗨,如果我想在这个对话框中添加更多的链接,那么我该怎么做呢?我尝试了多种方法,但都没有成功

function Links(){
  showAnchor('Link','http://LINK IN HERE');
}

function showAnchor(name,url) {
  var html = '<html><body><a href="'+url+'" target="blank" onclick="google.script.host.close()">'+name+'</a></body></html>';
  var ui = HtmlService.createHtmlOutput(html)
  SpreadsheetApp.getUi().showModelessDialog(ui,"demo");
}
函数链接(){
showAnchor('链接','http://LINK 在这里“);
}
函数showAnchor(名称、url){
var html='';
var ui=HtmlService.createHtmlOutput(html)
SpreadsheetApp.getUi().showModelessDialog(ui,“演示”);
}
函数getLinks(){
const ss=SpreadsheetApp.getActive();
const sh=ss.getSheetByName('Links');
常数sr=2;
const vs=sh.getRange(sr,1,sh.getLastRow()-sr+1,sh.getLastColumn()).getDisplayValues();
var html='';
vs.forEach(r=>{
html+=`
` }); 返回html; } 函数showMyAnchors(){ var html=''; html+='' html+=''; html+=''; html+='window.onload=function(){google.script.run.withSuccessHandler(函数(hl){document.getElementById(“links”).innerHTML=hl;}).getLinks();}; html+=''; html+=''; var ui=HtmlService.createHtmlOutput(html) SpreadsheetApp.getUi().showModelessDialog(ui,“演示”); }
链接页:

名称 链接 链接1 https://google.com 链接2 https://google.com
function getLinks() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName('Links');
  const sr = 2;
  const vs = sh.getRange(sr, 1, sh.getLastRow() - sr + 1, sh.getLastColumn()).getDisplayValues();
  var html='';
  vs.forEach(r=>{
    html+= `<br><a href="${r[1]}">${r[0]}</a>`
  });
  return html;

}

function showMyAnchors() {
  var html = '<html><body>';
  html += '<div id="links"></div>'
  html += '<input type="button" value="Close" onclick="google.script.host.close();" />';
  html += '<script>';
  html += 'window.onload = function(){google.script.run.withSuccessHandler(function(hl){document.getElementById("links").innerHTML=hl;}).getLinks();}';
  html += '</script>';
  html += '</body></html>';
  var ui = HtmlService.createHtmlOutput(html)
  SpreadsheetApp.getUi().showModelessDialog(ui, "demo");
}