回答編集履歴
4
修正
answer
CHANGED
@@ -72,26 +72,26 @@
|
|
72
72
|
```js
|
73
73
|
const bookmark_caption = 'この記事をブックマーク';
|
74
74
|
const bookmark_remove_caption = 'ブックマークを解除';
|
75
|
-
|
76
75
|
const code = 'bookmark438591'
|
76
|
+
const bookmark_on = 'on';
|
77
|
+
|
77
78
|
let bookmark_button = document.getElementById('bookmark_button');
|
78
|
-
|
79
79
|
let value = localStorage.getItem(code);
|
80
80
|
|
81
|
-
if (value ===
|
81
|
+
if (value === bookmark_on) {
|
82
82
|
bookmark_button.value = bookmark_remove_caption;
|
83
83
|
} else {
|
84
84
|
bookmark_button.value = bookmark_caption;
|
85
85
|
}
|
86
86
|
|
87
87
|
function bookmark() {
|
88
|
-
if (value ===
|
88
|
+
if (value === bookmark_on) {
|
89
89
|
bookmark_button.value = bookmark_caption;
|
90
90
|
value = null;
|
91
91
|
localStorage.removeItem(code);
|
92
92
|
} else {
|
93
93
|
bookmark_button.value = bookmark_remove_caption;
|
94
|
-
value =
|
94
|
+
value = bookmark_on;
|
95
95
|
localStorage.setItem(code,value);
|
96
96
|
}
|
97
97
|
}
|
3
修正
answer
CHANGED
@@ -87,14 +87,12 @@
|
|
87
87
|
function bookmark() {
|
88
88
|
if (value === 'on') {
|
89
89
|
bookmark_button.value = bookmark_caption;
|
90
|
+
value = null;
|
90
91
|
localStorage.removeItem(code);
|
91
|
-
value = null;
|
92
92
|
} else {
|
93
93
|
bookmark_button.value = bookmark_remove_caption;
|
94
94
|
value = 'on';
|
95
95
|
localStorage.setItem(code,value);
|
96
96
|
}
|
97
97
|
}
|
98
|
-
|
99
|
-
|
100
98
|
```
|
2
修正
answer
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
}
|
23
23
|
```
|
24
24
|
|
25
|
-
あとは地道なデバッグです。
|
25
|
+
あとは地道な[デバッグ](https://qiita.com/snoguchi/items/8f6bb62a3166eca23ac3)です。
|
26
26
|
処理がどこを通っているかとか、変数の内容とかの確認ですね。
|
27
27
|
|
28
28
|
```js
|
1
画像調整
answer
CHANGED
@@ -45,7 +45,7 @@
|
|
45
45
|
}
|
46
46
|
}
|
47
47
|
```
|
48
|
-

|
49
49
|

|
50
50
|
|
51
51
|
これで、「ボタンが反応している」かどうかが確認できます(idとか提示コードのままではないので質問者さんのほうでも確認してみてください)
|