ITeye博客

jQuery clipboard 使用 拷贝信息

bask · 2009-08-07 10:47 · jQuery · Web前端 · Markdown

<html>
	<head>
	<meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
	<script src="jquery.js" type="text/javascript"></script>
	<script src="jquery.clipboard.min.js" type="text/javascript"></script>
	<script>
		//在firefox中测试的是很需要放到tomcat下或者apache下
		jQuery(function($){
			jQuery.clipboardReady(function() {
				//复制
				jQuery("#复制信息").click(function () {
					jQuery.clipboard(jQuery.trim(jQuery("#信息").html()));
					alert("复制成功");
					return false;
				});
				//其他复制
			}, { swfpath: "jquery.clipboard.swf", debug: true });
		});
	</script>
</head>
	<body>
		<input id="复制信息" type="button" value="复制信息"/>
		<div id="信息">拷贝成功了 哈哈</div>
	</body>
</html>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。