質問編集履歴

1

javascript変更

2019/05/06 06:13

投稿

trafalbad
trafalbad

スコア303

test CHANGED
File without changes
test CHANGED
@@ -54,7 +54,7 @@
54
54
 
55
55
 
56
56
 
57
- // ファイルが選択されたら発動
57
+ // ファイルが選択されたら
58
58
 
59
59
  $('input[type=file]').change(function() {
60
60
 
@@ -66,9 +66,15 @@
66
66
 
67
67
  // 選択されたファイルが画像かどうか判定
68
68
 
69
- if (file.type === 'image/jpeg' && file.type === 'image/png') {
69
+ if (file.type != 'image/jpeg' && file.type != 'image/png') {
70
70
 
71
-     // 選択された画像を150pxにリサイズ
71
+ file = null;
72
+
73
+ blob = null;
74
+
75
+ return;
76
+
77
+ } else {
72
78
 
73
79
  file.width=150;
74
80
 
@@ -76,10 +82,6 @@
76
82
 
77
83
  document.ElementById('original-img').src=file;
78
84
 
79
- } else {
80
-
81
- return;
82
-
83
85
  }
84
86
 
85
87
  });