回答編集履歴

2

セミコロンが残ってたので

2019/11/28 05:18

投稿

dameo
dameo

スコア943

test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  this.textContent='Drag: (' + String(e.pageX) + ',' + String(e.pageY) + ')'
10
10
 
11
- };
11
+ }
12
12
 
13
13
  function handleDragOver(e) {
14
14
 
@@ -22,13 +22,13 @@
22
22
 
23
23
  return false;
24
24
 
25
- };
25
+ }
26
26
 
27
27
  function handleDrop(e) {
28
28
 
29
29
  this.textContent='Drop: (' + String(e.pageX) + ',' + String(e.pageY) + ')'
30
30
 
31
- };
31
+ }
32
32
 
33
33
  document.querySelectorAll('.column').forEach(col => {
34
34
 

1

loadイベントに変えたときにうっかり汚染してたので

2019/11/28 05:17

投稿

dameo
dameo

スコア943

test CHANGED
@@ -4,13 +4,13 @@
4
4
 
5
5
  window.addEventListener('load', e =>{
6
6
 
7
- this.handleDragStart = function(e) {
7
+ function handleDragStart(e) {
8
8
 
9
9
  this.textContent='Drag: (' + String(e.pageX) + ',' + String(e.pageY) + ')'
10
10
 
11
11
  };
12
12
 
13
- this.handleDragOver = function(e) {
13
+ function handleDragOver(e) {
14
14
 
15
15
  if (e.preventDefault) {
16
16
 
@@ -24,7 +24,7 @@
24
24
 
25
25
  };
26
26
 
27
- this.handleDrop = function(e) {
27
+ function handleDrop(e) {
28
28
 
29
29
  this.textContent='Drop: (' + String(e.pageX) + ',' + String(e.pageY) + ')'
30
30
 
@@ -34,11 +34,11 @@
34
34
 
35
35
  col.setAttribute('draggable', 'true');
36
36
 
37
- col.addEventListener('dragstart', this.handleDragStart, false);
37
+ col.addEventListener('dragstart', handleDragStart, false);
38
38
 
39
- col.addEventListener('dragover', this.handleDragOver, false);
39
+ col.addEventListener('dragover', handleDragOver, false);
40
40
 
41
- col.addEventListener('drop', this.handleDrop, false);
41
+ col.addEventListener('drop', handleDrop, false);
42
42
 
43
43
  });
44
44