veluit06 Posted July 26, 2009 Share Posted July 26, 2009 Hi friends, Using ajax i want to select all and copy clipboard code, please anybody help me. iam having two text boxes, first text box am entering values, after pressing tab key i want to focus next textbox in that time selectall text and copy the texts, please help me friends, thanks, Quote Link to comment Share on other sites More sharing options...
Mardoxx Posted July 28, 2009 Share Posted July 28, 2009 This is javascript, not ajax. But what the hell use the tabindex attribute of elements in your forms to control your "tab order" this tells your browser where to put the cursor next when you press tab function copyit(theField) { var tempval=eval("document."+theField) tempval.focus() tempval.select() therange=tempval.createTextRange() therange.execCommand("Copy") } then use the onFocus attribute of your form <form name="form"> <textarea name="textarea" onFocus="javascript:copyit(form.textarea)" taborder=2> TEXT GOES HERE </textarea> </form> references: http://www.webcheatsheet.com/HTML/controll_tab_order.php <- taborder http://javascript.internet.com/forms/select-and-auto-copy.html <- select and copy Quote Link to comment Share on other sites More sharing options...
veluit06 Posted July 29, 2009 Author Share Posted July 29, 2009 Thanks for this script. Everything working fine, but in Mozilla and Chrome this script is not working, where i have to concentrate for this browser support. please give me the solution Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.