【Web前端基础】js函数能复制吗

2021-01-15 10:25发布

5条回答

可以的,步骤如下

1.实现点击按钮,复制文本框中的的内容

1
2
3
4
5
6
7
8
9
10
11
[removed]"text/javascript">
function copyUrl2()
{
var Url2=document.getElementById("biao1");
Url2.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
alert("已复制好,可贴粘。");
}
[removed]
"button" onClick="copyUrl2()" value="点击复制代码" />


一周热门 更多>