HBCMS更多的中文手册参考:

effectAllowed参数属性

DHTML文档教程

Sets or retrieves, on the source element, which data transfer operations are allowed for the object.

dhtml语法

dataTransfer.effectAllowed(v) [ = sEffect ]

DHTML可能的值

sEffectString that specifies or receives one of the following values.
copySelection is copied.
linkSelection is linked to the drop target by the data transfer operation.
moveSelection is moved to the target location when dropped.
copyLinkSelection is copied or linked, depending on the target default.
copyMoveSelection is copied or moved, depending on the target default.
linkMoveSelection is linked or moved, depending on the target default.
allAll drop effects are supported.
noneDropping is disabled and the no-drop cursor is displayed.
uninitializedDefault. No value has been set through the effectAllowed property. In this case, the default effect still works, although it cannot be queried through this property.

The property is read/write. The property has a default value of uninitialized.

Remarks

Set the effectAllowed property in the ondragstart event. this property is used most effectively with the dropeffect property.

this property can be used to override the default behavior in other applications. for example, the browser script can set the effectallowed property to copy for a text field and thereby override the microsoft® word default of move. within the browser, copy is the default effectallowed behavior, except for anchors, which are set to link by default, and text fields, which are set to move by default.

setting effectallowed to none disables dropping but still displays the no-drop cursor. to avoid displaying the no-drop cursor, cancel the returnvalue of the ondragstart window.

DHTML代码范例

This example uses the dropEffect and effectAllowed properties to move text in a drag-and-drop operation.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Example of the effectAllowed and dropEffect Properties</TITLE>
<SCRIPT>
// This function is called when the user
//  initiates a drag-and-drop operation.
function fnHandleDragStart()
{
var oData = window.event.dataTransfer;
// Set the effectAllowed on the source object.
oData.effectAllowed = "move";
}
// This function is called by the target
//  object in the ondrop event.
function fnHandleDrop()
{
var oTarg = window.event.srcElement;
var oData = window.event.dataTransfer;
// Cancel default action.
fnCancelDefault();
// Set the content of the oTarget to the information stored
//  in the data transfer object in the desired format.
oTarg.innerText += oData.getData("text");
}
// This function sets the dropEffect when the user moves the
//  mouse over the target object.
function fnHandleDragEnter()
{
var oData = window.event.dataTransfer;
// Cancel default action.
fnCancelDefault();
// Set the dropEffect for the target object.
oData.dropEffect = "move";
}
function fnCancelDefault()
{
// Cancel default action.
var oEvent = window.event;
oEvent.returnValue = false;
}
</SCRIPT>
</HEAD>
<BODY>
<H1>Example of the effectAllowed and dropEffect Properties</H1>
<P>The code in this example sets the <B>effectAllowed</B> property
to <SPAN CLASS="literal">move</SPAN>. It sets the <B>dropEffect</B>
property to display the move cursor. The default action must be
canceled in all events that are handled&#151;in this example,
<B>ondragstart</B>, <B>ondragover</B>, <B>ondragenter</B>, and
<B>ondrop</B>.</P>
<B>
[not this text]
<SPAN ID="oSource" ondragstart="fnHandleDragStart()">
[select and drag this text]
</SPAN>
[not this text]
</B>
<P><BR><P>
<DIV ID="oTarget"
STYLE="background:beige;
height:100;
width:200;
border:solid black 1px;"
ondrop="fnHandleDrop()"
ondragover="fnCancelDefault()"
ondragenter="fnHandleDragEnter()">
[drop text here]
</DIV>
</BODY>
</HTML>
This feature requires Microsoft® Internet Explorer 5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

是否符合公共标准

There is no public standard that applies to this property.

Applies To

dataTransfer

更多语法参考

about dhtml data transfer, cleardata, getdata, setData