惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
MongoDB | Blog
MongoDB | Blog
月光博客
月光博客
The Cloudflare Blog
量子位
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog
MyScale Blog
MyScale Blog
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
G
Google Developers Blog
D
DataBreaches.Net
V
Visual Studio Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
U
Unit 42
博客园 - 聂微东
有赞技术团队
有赞技术团队
A
About on SuperTechFans

博客园 - 锐洋智能

A股怎么算的量比? CIDR 从最大网段 `0.0.0.0/0` → 最小单个 IP `/32`完整梳理 CIDR 无类别域间路由写法 Java 实现A股前复权/后复权计算原理 windows 下 降级迁移 Redis 8.8.0(源) → Redis 8.6.3(目标) Eclipse IDE for Enterprise Find/Replace 窗口可以"停驻" 安装 SDelete 方式 SDelete 的核心作用,不是 “删文件”,而是 “把你已经删掉的文件,彻底从磁盘上抹干净”,同时帮你把虚拟机里的 “空闲空间” 变成连续的、可被回收的状态。 windows 10 启动就运行了一个批处理文件 在什么地方修改?启动项中? 让 Spring Framework7.0.7 支持 velocity Java 9+ 开启了模块化安全限制,不允许 Ignite 直接访问底层内存地址,导致 Ignite 启动失败 Spring 5.x + 老项目的 JWT 拦截器 + 自动续期 接口鉴权:Session/Cookie 与 JWT 的核心区别 下是针对 RedisSessionManager 的 Tomcat context.xml 配置示例,覆盖基础单机 Redis、带密码 / 指定库、Redis 哨兵集群、自定义序列化 / 持久化策略 等常见场景 Redis-8.6.3-Windows-x64-cygwin 与 Redis-8.6.3-Windows-x64-msys2 有什么不一样? commons-fileupload2 M4 升级 M5 报错解决方案 阿里云的网络安全策略 ip 地址详细说明 Paralithic、 QLExpress、AviatorScript、exp4j 性能对比一下 java 序列化影响(重要!) paralithic 与 Aviator 表达式那一个更快 券商接受委托的完整时间线 jQuery 4.0 移除了许多已废弃的方法和特性 xheditor插件无限递归错误解决方法 jedis-7.1.0.jar 升级至 jedis-7.2.0.jar 就提示:The type JedisPoolConfig is deprecated The type JedisPooled is deprecated Spring 从 5.x 到 6.x 和 7.x 区别 安装 Microsoft Visual C++ 运行时 Java与Python进程通信优化方案 Autocomplete | jQuery UI 同一面页定义不同的 .ui-autocomplete Quartz的misfire处理策略设置不当导致Job在应用启动时立即执行。 mysql-connector-j-9.5.0.jar BUG
js 原生 剪切板 复制功能
锐洋智能 · 2026-01-10 · via 博客园 - 锐洋智能

js 原生 剪切板 复制功能

// 直接使用这个代码,完全不依赖任何外部库

(function() {

'use strict';

// 等待所有资源加载完成

if (document.readyState === 'loading') {

document.addEventListener('DOMContentLoaded', init);

} else {

setTimeout(init, 1000);

}

function init() {

// 设置按钮1:复制股票代码

setupCopy('#copybuttontechnical', function() {

var result = [];

$('.codetoday, .code').each(function() {

var text = $(this).text().trim();

var parts = text.split(':');

result.push(parts.length > 2 ? parts[2] : text);

});

return result.join('\n');

}, '股票代码');

// 设置按钮2:复制完整信息

setupCopy('#copybuttontechnicalall', function() {

var target = $('#technical_pageFormContent');

if (!target.length) return '';

var element = target[0];

return element.innerText || element.textContent;

}, '完整信息');

}

function setupCopy(selector, getText, description) {

var button = $(selector);

if (!button.length) return;

button.off('click.copy').on('click.copy', function(e) {

e.preventDefault();

e.stopPropagation();

var text = getText();

if (!text || text.trim() === '') {

alert('没有内容可复制');

return;

}

if (copyText(text)) {

alert(description + '已复制到剪贴板!');

} else {

alert('复制失败,请手动选择文本复制');

}

});

}

function copyText(text) {

var temp = $('<textarea>').css({

position: 'fixed',

left: '-9999px',

top: '0',

opacity: '0'

}).val(text).appendTo('body');

temp[0].select();

temp[0].setSelectionRange(0, 99999);

var success = false;

try {

success = document.execCommand('copy');

} catch (err) {

// 静默失败

}

temp.remove();

return success;

}

})();