【发布时间】:2021-02-19 23:06:39
【问题描述】:
我在 Tampermonkey 中有这个 javascript 代码:
var footerDiv = document.getElementsByClassName("copyright")[0];
window.addEventListener('load', function() {
var button = document.createElement('button')
footerDiv.append(button)
button.src = 'https://img.shields.io/badge/%20-ComuBot--Tranlator-%23159818';
button.href = "https://github.com/AnonHexo/public-scripts";
button.id = 'srcButton';
})
但是当我运行代码时,按钮没有出现(显示为点“.”),并且没有 src 和 href 属性。
我尝试添加按钮的网站是https://comubot.cf
请帮助我。谢谢
【问题讨论】:
标签: javascript html dom href src