HTML 元素的 ondragenter 事件

news/2025/2/26 13:32:34

ondragenter Event

DHTML文档教程


Fires on the target element when the user drags the object to a valid drop target.

dhtml语法

Inline HTML

<ELEMENT ondragenter = "handler" ... >

All platforms

Event property

object.ondragenter = handler

JScript only

object.ondragenter = GetRef("handler")

Visual Basic Scripting Edition (VBScript) 5.0 or later only

Named script

<SCRIPT FOR = object EVENT = ondragenter>

Internet Explorer only

Event Information

Bubbles

Yes

Cancels

Yes

To invoke

·                         Drag the selection over a valid drop target within the browser.

·                         Drag the selection to a valid drop target within another browser window.

Default action

Calls the associated event handler.

Event Object Properties

Although event handlers in the DHTML Object Model do not receive parameters directly, a handler can query an event object for data.

Remarks

You can handle the ondragenter event on the source or on the target object. Of the target events, it is the first to fire during a drag operation. Target events use the getData method to stipulate which data and data formats to retrieve. The list of drag-and-drop target events includes:

· onbeforepaste

· onpaste

· ondragenter

· ondragover

· ondragleave

· ondrop

when scripting custom functionality, use the returnvalue property to disable the default action.

DHTML代码范例

This example shows when and where each event fires during a drag-and-drop operation by listing each event and the name of the object firing it in a list box.

<HEAD>

<SCRIPT>

var oNewOption;

// Code for dynamically adding options to a select.

function ShowResults()

{                              // Information about the events

// and what object fired them.

arg = event.type + "  fired by  " + event.srcElement.id;

oNewOption = new Option();

oNewOption.text = arg;

oResults.add(oNewOption,0);

}

</SCRIPT>

</HEAD>

<BODY>

<P>Source events are wired up to this text box.</P>

<INPUT ID=txtDragOrigin VALUE="Text to Drag"

οndragstart="ShowResults()"

οndrag="ShowResults()"

οndragend="ShowResults()"

>  

<P>Target events are bound to this text box.</P>

<INPUT ID=txtDragDestination VALUE="Drag Destination"

οndragenter="ShowResults()"

οndragοver="ShowResults()"

οndragleave="ShowResults()"

οndrοp="ShowResults()"

>  

<SELECT ID=oResults SIZE=30>

<OPTION>List of Events Fired

</SELECT>

</BODY>

 


http://www.niftyadmin.cn/n/4411441.html

相关文章

论文阅读《PTR: Prompt Tuning with Rules for Text Classification》

PTR: Prompt Tuning with Rules for Text Classification 提出背景 Prompt-oriented fine-tuning加速收敛&#xff0c;对少次学习很友好 Prompt-tuning收敛变慢&#xff0c;因为参数变少 Prompt痛点 Hard prompt设计麻烦 Auto prompt 效率太低 Soft prompt 需要大模型来…

javascript 操作 cookies

javascript 操作 cookies Cookies&#xff0c;有些人喜欢它们&#xff0c;有些人憎恨它们。但是&#xff0c;很少有人真正知道如何使用它们。现在你可以成为少数人中的成员&#xff0d;可以自傲的Cookie 大师。 如果你象作者一样记性不好&#xff0c;那么你可能根本记不住人们…

论文阅读《Knowledgeable Prompt-tuning: Incorporating Knowledge into Prompt Verbalizer for Text Classific》

Knowledgeable Prompt-tuning: Incorporating Knowledge into Prompt Verbalizer for Text Classification 提出背景 提示学习&#xff08;prompt learning&#xff09;在预训练语言模型的利用中发挥重要作用 以主题分类为例&#xff1a;将输入句子包装到一个自然语言模板中…

基于一个多分类问题比较bert单任务训练和多任务训练

笔者在学习基于huggingface实现多分类问题时&#xff0c;使用了kaggle比赛中的Feedback Prize - Predicting Effective Arguments中的数据集。 Feedback Prize - Predicting Effective Arguments/Dataset 本次比赛的目标是将学生写作中的争论元素分类为“有效”、“充分”或“…

JS Array对象

JS入门之Array对象 每天一对象,今天我们也来new一个。没有系统的学过JS&#xff0c;没有特别的写过一个比较出色的类库&#xff0c;没有运用过一个很强的类库&#xff0c;prototype.js在进行着&#xff0c;慢慢的前进相信不久的将来就可以应用prototype.js来开发自己的应用程序…

C#对动态语言的支持

1&#xff0c;infoq上的一篇文章&#xff0c;好好参考一下。地址&#xff1a;http://www.infoq.com/cn/news/2007/06/java-dlr微软在动态语言支持上超越了Java&#xff1f;作者 Werner Schuster译者 李鑫 发布于 2007年6月30日 下午11时30分 当.NET 在2000/2001年第一次发布…

论文阅读《How Does Knowledge Graph Embedding Extrapolate to Unseen Data: A Semantic Evidence View》

https://arxiv.org/abs/2109.11800 https://github.com/renli1024/SE-GNN 论文概览 现有的KGE工作大多集中在精巧的三元组建模函数的设计上&#xff0c;主要告诉我们如何衡量观察到的三元组的似然性。 在这篇文章中&#xff0c;我们试图研究两个问题的KGE外推: 1.KGE如何…

什么是Groovy

rel"File-List" href"file:///C:%5CDOCUME%7E1%5Cguofc%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml">什么是Groovy Groovy是一种语言&#xff0c;Groovy的规则比Java少得多。Java平台仅关心使字节码得到执行。此平台不强迫您使用Java语…