Chrome IE FF 用JS复制到粘贴板方法
Chrome IE FF 用JS复制到粘贴板方法直接上代码 :<!doctype html>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<title>demo</title>
</head>
<body>
<input type="text" id="demo" />
<input type="button" id="button" value="复制" />
<script>
document.getElementById('button').onclick=function(){
var obj = document.getElementById('demo');
obj.select();
document.execCommand("Copy");
}
</script>
</body>
</html>
基于execCommand的插件 http://clipboardjs.52fhy.com/
页:
[1]