页面插入按钮

在页面尾部插入按钮

目前为 2023-09-16 提交的版本。查看 最新版本

// ==UserScript==
// @name         页面插入按钮
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description  在页面尾部插入按钮
// @author       TCH
// @match        *://*.com/*
// @grant        none
// ==/UserScript==
 
(function()
{
let div=document.createElement("div");
div.style="position:fixed; bottom:0; left: 0; margin: auto; right: 0;text-align:center;"
div.innerHTML='<span id="span-1"style="width:150rpx;margin:10px;background-color: red;font-size: 16px;border-color: red;border-radius: 5px;" >标注</span><span class="sp" style="width:150rpx;margin:10px;font-size: 16px;border-radius: 5px;">取消</span>';
div.onclick=function(event){
    if(event.target.id=="span-1"){
        alert("span-1被点击了");
    }else if(event.target.className=="sp"){
        alert("sp这一类被点了");
    }
};
document.body.append(div);

 
})();