1、dataTransfer

  1. <script>
  2. // 只在chrome支持,而且要看光标
  3. var Dragstart = document.getElementsByClassName('a')[0];
  4. Dragstart.ondragstart = function () {
  5. e.dataTransfer.effectAllowed = "link";// 必须在ondragstart中使用
  6. }//link copy move copyMove linkMove all
  7. Dragstart.ondrop = function () {
  8. e.dataTransfer.dropEffect = "link";// 需要和allowed对应
  9. }
  10. </script>