Javascript Onclick Highlight To Select And Copy

RegisterLogin
Javascript Onclick Highlight To Select And Copy
Post Description: Javascript Onclick Highlight To Select And Copy
Tags: Javascript, Onclick, Highlight, To, Select, And, Copy
This Post Was Posted On Jun 04, 2008 By hotsalsa #1448
how do i enable automatic select a text field with javascript?

i mean if i have a form and i want the user to just click the field and be able to copy
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
veta
#1870 1
doesn't work in firefox (selecting, but not copying)
Aug 30, 2009 Reply Report abuse
Web Hosting Support
#1869 2

DEMO of Code Above

Text Field:

Jul 16, 2009 Reply Report abuse
Web Hosting Support
#1868 3
you can use this code:

<script type="text/javascript">
function select_all(obj)
{ var text_val=eval(obj);
text_val.focus();
text_val.select();
if(!document.all) return; // IE only
r= text_val.createTextRange();
r.execCommand('copy');
}
</script>
<p>Text Field:
<input name="textfield" type="text" size="40" value="click here to highlight" onclick="select_all(this)">
</p>
Jun 04, 2008 Reply Flagged!
Leave Your Comments...
©2011 Webune Forums - Sun Dec 18, 2011 9:53 pm
Powered by: Webune Forums V3