<input type="text">
<button>复制</button>
<script>
var input = document.getElementsByTagName(‘input‘)[0]
var button = document.getElementsByTagName(‘button‘)[0]
button.onclick = function(){
input.value = "hello world"
input.select()
document.execCommand("copy")
}
</script>
cut
delete
copy
原文地址:http://blog.51cto.com/12173069/2106070
时间: 2024-10-15 08:28:48