Sunday, April 08, 2007

Copy Text To Clip Board Using Java Script


<script type="text/javascript">
function ClipBoard()
{
window.clipboardData.setData("Text", document.getElementById('TextBox1').value);
var text = window.clipboardData.getData("Text");

}
</script>

</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server">Text to copy here</asp:TextBox><br />
<br />
<input id="Button1" type="button" value="Copy to Clipboard" onclick="ClipBoard()" />

</div>
</form>
</body>
</html>

No comments: