JavaScript Reference/Javascript Properties/effectAllowed

Материал из Web эксперт
Перейти к: навигация, поиск

"effectAllowed" Example

   <source lang="javascript">
   

<html> <head> <script language="JavaScript"> function transferDrop() {

   window.event.srcElement.innerText = window.event.dataTransfer.getData("text");
   window.event.returnValue = false; 

} function transferDrag() {

   window.event.dataTransfer.dropEffect = "move"; 
   window.event.returnValue = false; 

} </script> </head> <body bottommargin="150">

Highlight text in this paragraph and drag it to the text area bellow

<textarea id="myTarget"

         ondrop="transferDrop();" 
         ondragover="window.event.returnValue = false;" 
         ondragenter="transferDrag();">

</textarea>


     </source>
   
  


"effectAllowed" is applied to

   <source lang="javascript">

+----------------+--------------------------------------------------------------+ | Applied_To |dataTransfer | +----------------+--------------------------------------------------------------+

     </source>
   
  


"effectAllowed" Possible Values

   <source lang="javascript">

Possible Values copy allows the copy operation, link allows the selection to be linked with the drop target move allows the selection to be moved to the drop target copyLink allows the copy or link operation,

              depending on the target settings, 

copyMove allows the copy or move operation,

              depending on the target settings, 

linkMove allows the link or move operation,

              depending on the target settings, 

all allows all drop effects), none no drop effect is allowed and

              the no-drop cursor is shown

uninitialized the default; the effectAllowed property

              has not been initialized yet
   
     
     </source>
   
  


"effectAllowed" Syntax and Note

   <source lang="javascript">

Note: Read and write property. Sets the data transfer operation. This property must be accompanied by the dropEffect property.

Syntax:

window.event.dataTransfer.effectAllowed = value


     </source>