I have a list of people on the left hand side of a page, this list is populated by PHP.
Each person is in their own div (this can be changed but I thought div's may be easier to work with). I want to be able to drag any one of these people onto a textbox, thus entering their name into that textbox.
Also to make it more awkward, I don't really want to be using jQuery or prototype. Or any of the others really.
Edit:
Sorry let me rephrase the question...
How would I check to see if something has been dragged on top of a textbox? And how would I get the ID of that element?
What I don't know is how to check if something has been dragged on top of the textbox (input box, not text area, but that's no big issue.)
I know there would never be a magical param like onDragOnto=""
but hopefully that will show you what I mean
Without more details, I can't really provide a better answer.
How about clicking within the DIV element resulting in a Javascript event to be fired which causes the element's text to be selected? Then, you can drag this text into a multiline textarea.
Now, with the information from the edit:
You'd register a onmousedown event with each DIV that you have.
On the names:
<div onmousedown="onMouseDown(event);" onmouseup="onMouseUp(event);">Jane</div>
On the textarea/textbox:
<textarea onmouseover="return onMouseOver(event);"></textarea>
And a script:
<script>
function onMouseOver(evt) {
target = document.lastClicked;
if (target != null) {
window.alert(target.id);
}
}
function onMouseDown(evt) {
document.lastClicked = window.event.target;
}
function onMouseUp(evt) {
document.lastClicked = null;
}
</script>
This is a very crude way to do things, but I hope this gives you the principles that you're looking for. If you want to force the elements to move rather than just using text drag-and-drop, then things get more hairy. To handle that, you'll need to use CSS and modify the coordinates.