Home > Web Front-end > HTML Tutorial > Code for clipboard operations! Test_html/css_WEB-ITnose

Code for clipboard operations! Test_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:16:37
Original
969 people have browsed it



操作剪板

<script> <br> function copyToClipboard() <br> { <br> var d=document.all("source").value; <br> window.clipboardData.setData('text', d); <br> } <br> <br> function setValue() <br> { <br>     var t=new Array(); <br>     var t=window.clipboardData.getData('text').split("n"); <br>     var h1; <br>     var h2; <br>     var h3; <br>     var h4; <br>     h1 = "<table border='1'><tr>"; <br>     h2 = "<td>"; <br>     h3 = "</td>"; <br>     h4 = "</tr></table>"; <br>     var obj = document.getElementById("dodododo"); <br>     //alert(document.getElementById()); <br>     alert(t.length); <br>     alert(t[0]); <br>      <br>     //alert(t[0].split("t")[1]); <br>     var h = ""; <br>     for(var i=0;i<t.length-1;i ){ <br>         <br>        h = h   h2   t[i]    h3; <br>     } <br>     obj.innerHTML = h1   h   h4; <br>     //obj.innerHTML = "<table border='1'><tr><td>"   t[0]   "</td><td>"   t[1]   "</td></tr></table>" <br>     //document.getElementById("xm").innerHTML=t[0]; <br>     //document.getElementById("xb").innerHTML=t[1].split("rn")[1]; <br>     //document.getElementById("nl").innerHTML=t[2].split("rn")[1]; <br>     //document.getElementById("mz").innerHTML=t[3].split("rn")[1]; <br> } <br> <br> function getvalue() <br> { <br>     var t=window.clipboardData.getData('text').split("n"); <br>     alert(t[3]); //第一行 <br>     var b=t[3].split("t");  <br>     alert(b[0]);//第一列 <br> } <br> <br> </script>







清空
AA







表格作成用


Heading
Another Heading


row 1, cell 1
row 1, cell 2


row 2, cell 1
row 2, cell 2


回复讨论(解决方案)

貌似你这个不支持所有浏览器吧!你去看看现在的剪切按钮,然后右键看一下,全部都是用flash实现的!都是用的ZeroClipboard

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template