English 中文(简体)
Drag and Drop into a text Box
原标题:Drag and Drop into a 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

最佳回答

如果没有更多的细节,我实际上无法提供更好的答案。

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.

现在,根据编辑提供的资料:

d 你们与你们的每个DIV一起登记一次降级活动。

On the names:

<div onmousedown="onMouseDown(event);" onmouseup="onMouseUp(event);">Jane</div>

关于文本领域/文本框:

<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>

这是做事的非常粗略的方法,但我希望这给你带来了你们重新思考的原则。 如果你想强迫这些要素移动,而不是仅仅使用拖拉和干.的案文,那么事情就会更加美发。 为了处理此事,你需要利用安保科并修改坐标。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签