Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drag and drop functionality 1

Status
Not open for further replies.

dpdoug

Programmer
Nov 27, 2002
455
US
All I need to do is: In a javascript function I need to select the text in the control on the onclick event.

The reason I want to do this is that I can take advantage of the windows defualt drag and drop functionality.

The user will left-click and hold down the desired data item which will select the text.

She will "drag" it to the desired destination and release the mouse button ("drop") causing the data to paste into the textbox under the pointer.
 
if all you want to do is select the text when they click a text box is the following

<form name="form1">
<input type="text" name="text1" value="asdf" onClick="document.form1.text1.select();">
</form>


Keith


The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
 
Maybe onfocus would be better in case they tab into the field.

Adam

Whatever I feel like I wanna do, gosh!
 
yeah adam is right, use onFocus to select the text instead of onClick


Keith


The most likely way for the world to be destroyed, most experts agree, is by accident. That's where we come in; we're computer professionals. We cause accidents.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top