---
title: "Jquery 实现复制到剪贴板"
author: "hsys"
date: "2010-03-04T09:21:13Z"
tags: []
categories: ["Web前端"]
slug: "jquery"
draft: false
lastmod: "2010-03-04T09:23:57Z"
id: 607443
url: "https://hsys.iteye.com/blog/607443"
---

不兼容Firefox


```html

<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>

```