Jquery 实现复制到剪贴板
不兼容Firefox
<html>
<head>
<title>Selector</title>
<script type='text/javascript' src="jquery/jquery-1.3.1.js"></script>
<script type='text/javascript' src="jquery.copy.js"></script>
<script language="javascript">
$(document).ready(function(){
$("#copy").click(function(){
var text = $("#text").val()
alert(text);
$.copy(text);
alert("成功到剪贴板");
});
});
</script>
<body>
<p><b>Values: </b></p>
<br>
<form>
<textarea name="name" id="text" rows="5" >hello world</textarea>
<input type="button" value="复制" id="copy" />
</form>
</body>
</html>
我用你的这方法,根本就没有复制到剪切板。。。 jquery.copy.js我试了两个版本的,都不行,我是奇怪你这样写为啥就行呢?? 后来我是换了最原始的方法完成的: