【“我的”网页我做主】复制不能复制的表格

查看 57|回复 3
作者:hualy   
问题:不能够复制表格的内容


图片1.png (30.58 KB, 下载次数: 0)
下载附件
2024-6-16 23:14 上传

方法:移除js,然后就可以复制了
油猴脚本:[JavaScript] 纯文本查看 复制代码
// ==UserScript==
// @name         Remove JS Button
// @version      1.0
// @description  Add a button to remove specified HTML tags from the current page and remove itself after clicking
// @AuThor       hualy13
// @match        *://*/*
// @grant        none
// ==/UserScript==
(function() {
    'use strict';
    function removeTags(tagNames) {
        tagNames.forEach(function(tagName) {
            // 获取所有指定标签
            var elements = document.querySelectorAll(tagName);
            // 遍历所有的指定标签并移除它们
            elements.forEach(function(element) {
                element.parentNode.removeChild(element);
            });
        });
    }
    // 创建按钮元素
    var removeButton = document.createElement('button');
    removeButton.textContent = 'Remove JS';
    removeButton.style.position = 'fixed';
    removeButton.style.top = '250px';
    removeButton.style.right = '20px';
    removeButton.style.zIndex = '9999';
    // 将按钮添加到页面上
    document.body.appendChild(removeButton);
    // 添加按钮点击事件
    removeButton.addEventListener('click', function() {
        // 调用函数删除  和  标签
        removeTags(['link', 'script']);
        // 移除按钮自身
        removeButton.parentNode.removeChild(removeButton);
    });
    // 隐藏按钮的右键菜单
    removeButton.addEventListener('contextmenu', function(event) {
        event.preventDefault();
        removeButton.style.display = 'none';
    });
    // 当文档双击时,恢复按钮
    document.addEventListener('dblclick', function() {
        removeButton.style.display = 'block';
    });
})();
点击移除js


图片2.png (5.27 KB, 下载次数: 0)
下载附件
2024-6-16 23:14 上传

显示为


图片3.png (18.56 KB, 下载次数: 0)
下载附件
2024-6-16 23:14 上传

全选并复制


图片4.png (45.16 KB, 下载次数: 0)
下载附件
2024-6-16 23:14 上传



图片5.png (42.05 KB, 下载次数: 0)
下载附件
2024-6-16 23:14 上传

粘贴到Excel


图片6.png (55.2 KB, 下载次数: 0)
下载附件
2024-6-16 23:14 上传

接下来就可以进行其他操作啦,比如绩点求均。

下载次数, 下载附件

似水流年2015   

这么好的脚本,怎么没有人来夸一下作者啊
MQ19781011   


似水流年2015 发表于 2024-6-16 23:36
这么好的脚本,怎么没有人来夸一下作者啊

主要是不会用。。。。。。
msmvc   

刚开的哟,还热乎着呢
您需要登录后才可以回帖 登录 | 立即注册

返回顶部