承易 发表于 2022-4-17 12:59
大佬 文字 我加了点击链接 但没反应 如何破
给它绑定的点击事件
// ==UserScript==
// @name New Userscript
// @match *://*.tampermonkey.net.cn*
// @version 0.1.0
// @description try to take over the world!
// @author You
// @run-at document-end
// @grant unsafeWindow
// @require https://lib.baomitu.com/jquery/2.0.0/jquery.min.js
// ==/UserScript==
var _w = unsafeWindow,
$ = _w.jQuery || top.jQuery;
(function() {
'use strict';
// Your code here...
var box_html = `<div style="border: 2px dashed rgb(0, 85, 68); width: 330px; position: fixed; top: 50%; left: 0%; z-index: 99999; background-color: rgba(184, 247, 255, 1); overflow-x: auto;">
<h3 style="text-align: center;">div</h3>
<div>
<table border="1">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td id="baidu">跳转百度</td>
<td id="price">$100</td>
</tr>
</table>
</div>
</div>`;
$(box_html).appendTo('body');
$('#price').on('click',function(){
alert("被点击了")
})
$('#baidu').on('click',function(){
_w.location.href = "https://baidu.com"
})
})();