Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/70.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 单击“不处理表格”按钮将文本复制到剪贴板_Javascript_Google Apps Script - Fatal编程技术网

Javascript 单击“不处理表格”按钮将文本复制到剪贴板

Javascript 单击“不处理表格”按钮将文本复制到剪贴板,javascript,google-apps-script,Javascript,Google Apps Script,我已经创建了一个谷歌网络应用程序,其中包含数据-点击这个bucket时,在bullet中的票号文本应该得到一个副本 复制脚本在表的第一行和第二行上工作正常—它不工作 我已经附上下面的脚本,请帮助我解决这个问题 函数doGet(){ 返回HtmlService .createTemplateFromFile('索引') .evaluate().setTitle(“主页”).setSandboxMode(HtmlService.SandboxMode.IFRAME); 返回html; } 函数ge

我已经创建了一个谷歌网络应用程序,其中包含数据-点击这个bucket时,在bullet中的票号文本应该得到一个副本

复制脚本在表的第一行和第二行上工作正常—它不工作

我已经附上下面的脚本,请帮助我解决这个问题

函数doGet(){
返回HtmlService
.createTemplateFromFile('索引')
.evaluate().setTitle(“主页”).setSandboxMode(HtmlService.SandboxMode.IFRAME);
返回html;
}
函数getData(){
返回电子表格应用程序
.openById('1Nf080XKVLtt2AWr469aJrh6vhjdeinxBP1ehV3qBA64')
.getDataRange()
.getValues();
}

公开请求
需求ID
请求者名称
需求类型
功能副本(元素id){
var aux=document.createElement(“div”);
辅助设置属性(“内容可编辑”,真);
aux.innerHTML=document.getElementById(元素id).innerHTML;
aux.setAttribute(“onfocus”、“document.execCommand('selectAll',false,null)”);
文件.正文.附件(aux);
辅助焦点();
文件。执行命令(“副本”);
文件.body.removeChild(aux);
}


您应该为每个
td
字段使用唯一的
id
值,如下例所示。不能对每个
td
使用相同的
id


公开请求
需求ID
请求者名称
需求类型
函数副本($event){
var aux=document.createElement(“div”);
辅助设置属性(“内容可编辑”,真);
//注意我们是如何检索innerHTML的
aux.innerHTML=$event.target.innerHTML;
aux.setAttribute(“onfocus”、“document.execCommand('selectAll',false,null)”);
文件.正文.附件(aux);
辅助焦点();
文件。执行命令(“副本”);
文件.body.removeChild(aux);

}
您应该为每个
td
字段使用唯一的
id
值,如下例所示。不能对每个
td
使用相同的
id


公开请求
需求ID
请求者名称
需求类型
函数副本($event){
var aux=document.createElement(“div”);
辅助设置属性(“内容可编辑”,真);
//注意我们是如何检索innerHTML的
aux.innerHTML=$event.target.innerHTML;
aux.setAttribute(“onfocus”、“document.execCommand('selectAll',false,null)”);
文件.正文.附件(aux);
辅助焦点();
文件。执行命令(“副本”);
文件.body.removeChild(aux);

}
获取一些格式错误的html内容时出错:。(第3行,文件“代码”)Hm。。动态模板使用的语言基本上应该更改每个td的
id
。您的模板语言应该为您提供一些选项,以便动态生成元素的
id
。@KiranShety I将答案更新为使用no
id
s。请查看更新的答案。谢谢,请允许我花一些时间使用模板“”中的应用程序脚本函数获取一些html错误格式错误的html内容:。(第3行,文件“代码”)Hm。。动态模板使用的语言基本上应该更改每个td的
id
。您的模板语言应该为您提供一些选项,以便动态生成元素的
id
。@KiranShety I将答案更新为使用no
id
s。请查看更新的答案。谢谢,请给我一些时间使用模板“”中的应用程序脚本函数