操作剪板 <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 = ""; <br /> h4 = ""; <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>" + t[1] + "" <br /> //document.getElementById("xm").innerHTML=t[0]; <br /> //document.getElementById("xb").innerHTML=t[1].split("\r\n")[1]; <br /> //document.getElementById("nl").innerHTML=t[2].split("\r\n")[1]; <br /> //document.getElementById("mz").innerHTML=t[3].split("\r\n")[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