为按钮添加一个开放的URL处理程序 [英] Add an open url handler to a button

查看:58
本文介绍了为按钮添加一个开放的URL处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个按钮,并且我已经向该按钮应用了一个处理程序来收集某些字段的数据并将它们记录在电子表格中。
然而,我希望在这个操作结束时,脚本打开一个url(插入到我的脚本中的网站的摘要页面)。
如何通过处理程序将链接应用于按钮?



我正在尝试做一些我认为很简单并且被证明是一个谜。我看过很多的stackoverflow页面,但我还没有找到答案。

你可以使用ahtml来做到这一点元素并将其关联到onclick属性。

以下是演示

和来源此处



代码的基本部分:

 < a href = < =&yourURL GT;? target =_ blank
onclick =google.script.run.scriptAction(this.parentNode);>点击我!< / a>


I created a button and I have applied to this button a handler to collect the data of some fields and record them in a spreadsheet. I wish, however, at the end of this operation, the script to open a url (summary page of the site where it is plugged into my script). How can I apply a link to the button via a handler?

I'm trying to do something I thought was rather simple and is proving to be an enigma. I watched through many stackoverflow pages but i haven't found an answer.

解决方案

you can do that using a "a" html element and associate it a onclick attribute.
Here is a demo
and the source here

the essential part of the code:

<a href="<?=yourURL?>" target="_blank"   
onclick="google.script.run.scriptAction(this.parentNode);">click me!</a>

这篇关于为按钮添加一个开放的URL处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆