Does anyone have code that will fill a textbox with the contents of the most recent clipboard addition on page load?what "the most recent clipboard addition" means?
u can do that like
<body onload="fill()">
</body>
<script>
function fill()
{
document.all.txtabc.Value="abc";
}
hope this help u
</script>
Hi
You can use this Javascript to get the data from clipboard
<Script Language="JavaScript">
var content = clipboardData.getData("Text");
if (content!=null)
{
document.getElementByID("TextBox1").value=content;
}
</Script>
The code will works perfectly in IE and Netscape....
Check this linkhttp://www.sourcecodesworld.com/special/clipboard.asp
regards
Anz
Is there any securities tags that must be enabled/disabled inorder to paste from the clipboard to a textbox?
IE has a setting (under andvanced in internet options) that does not allow paste operations from a script. I personally have it disabled so it would not work on my machine.
Eric
Here is a sample of the main parts of my html code:
<body onload="document.forms[0]['TextBox1'].focus()" ms_positioning="GridLayout">
<form runat="server">
<p> Serialnumber:
<asp:TextBox id="TextBox1" runat="server" Width="144px" OnTextChanged="GetInfo_Click"> </p>
<script language="JavaScript"> var content = clipboardData.getData("Text"); if (content!=null) { document.getElementByID("TextBox1").value=content; } </script>
<ASP:DataGrid id="MyDataGrid" runat="server" Width="700px" Font-Size="8pt" Font-Names="Verdana" BackColor="#CCCCFF" BorderColor="Black" CellPadding="3" Font-Name="Verdana" HeaderStyle-BackColor="#aaaadd">
<HeaderStyle backcolor="#AAAADD">
</ASP:DataGrid>
</form>
</body>
The problem is that on the load of the page I get an IE error stating "Object doesn't support this property or method"
I think that the problem is because the textbox is ran at server and the clipboard paste is client side.
Any suggestions?
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment