我正在尝试创建一个带有字段名称并将它们复制到剪贴板的书签。 我收到错误预期分配或函数调用,而是看到一个表达式。
function copy() {
var number = document.getElementById('sys_readonly.rm_story.number').value,
shortDescription = document.getElementById('rm_story.short_description').value,
d = new Date(),
year = d.getFullYear(),
month = d.getMonth(),
day = d.getDate(),
name = year + month + day + ' - ' + number + ' - ' + shortDescription;
name.select(),
document.execCommand("copy");
}
答案 0 :(得分:0)
您应该在行
的末尾使用;
代替,
答案 1 :(得分:0)
跟进您的上次评论
可能重复,您的问题将在:JavaScript execCommand('copy') not working