网页中实现复制功能
2015-07-08 15:57
405 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head> <body> <table width="600" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <script> function copyit() { document.all.text.select(); document.execCommand("copy"); alert("成功复制文字1"); }</script> <textarea name="text" cols="40" rows="5"></textarea> <input name="select" type="button" onclick=" copyit()" value="复制1" /> </td> <td> <script> function copyit2() { document.all.text2.select(); document.execCommand("copy"); alert("成功复制文字2"); }</script> <textarea name="text2" cols="40" rows="5"></textarea> <input name="select2" type="button" onclick=" copyit2()" value="复制2" /> </td> </tr> <tr> <td> <script> function copyit3() { document.all.text3.select(); document.execCommand("copy"); alert("成功复制文字3"); }</script> <textarea name="text3" cols="40" rows="5"></textarea> <input name="select3" type="button" onclick=" copyit3()" value="复制3" /> </td> <td> <script> function copyit4() { document.all.text4.select(); document.execCommand("copy"); alert("成功复制文字4"); }</script> <textarea name="text4" cols="40" rows="5"></textarea> <input name="select4" type="button" onclick=" copyit4()" value="复制4" /> </td> </tr> </table> </body> </html>
相关文章推荐
- Java编程语言中栈与堆内存区别详解
- MS-DOS命令
- 在Oracle中如何删除表中设计重复数据
- js字的数目的计算方法(与word计算公式为)
- 【算法学习笔记】64. 枚举法 SJTU OJ 1381 畅畅的牙签
- IntelliJ IDEA 使用心得与常用快捷键
- ANUSPLIN Vrsn 4.4
- 数据库死锁的解决办法
- ==与equal在java中应用的感悟
- Dynamics AX 2012 R2 AIF 错误 '/MicrosoftDynamicsAXAif60' 应用程序中的服务器错误
- 使用Kotlin开发Android应用(III):扩展函数和默认值
- 好用的linux命令收集
- Android淡入淡出欢迎界面
- Elasticsearch scoring detailed explanation
- Windows上搭建Eclipse的Hadoop调试环境
- mysql开发之---每日一得01
- centos+mono+nginx+jexus 搭建linux下c#运行环境测试
- java代码--mysql数据的备份和还原
- C#绘制表格与折线图
- LoadRunner上传及下载文件