网页前端后台技巧(CSS+HTML)【HTML+CSS】

html点击复制功能

2019-06-25  本文已影响2人  啊试

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript">

        function copy() {

                var e = document.getElementById("copy");

                e.select(); // 选择对象

                document.execCommand("Copy"); // 执行浏览器复制命令

                alert("复制成功!");

                }

</script>

</head>

<body>

<textarea id="copy">https://blog.csdn.net/yuzsmc</textarea>

<input type="button" onclick="copy();" value="点击复制"></input>

</body>

</html>

上一篇 下一篇

猜你喜欢

热点阅读