回答編集履歴

4

修正

2019/04/04 14:10

投稿

m.ts10806
m.ts10806

スコア80850

test CHANGED
@@ -146,19 +146,19 @@
146
146
 
147
147
  const bookmark_remove_caption = 'ブックマークを解除';
148
148
 
149
-
150
-
151
149
  const code = 'bookmark438591'
152
150
 
153
- let bookmark_button = document.getElementById('bookmark_button');
151
+ const bookmark_on = 'on';
154
152
 
155
153
 
154
+
155
+ let bookmark_button = document.getElementById('bookmark_button');
156
156
 
157
157
  let value = localStorage.getItem(code);
158
158
 
159
159
 
160
160
 
161
- if (value === 'on') {
161
+ if (value === bookmark_on) {
162
162
 
163
163
  bookmark_button.value = bookmark_remove_caption;
164
164
 
@@ -172,7 +172,7 @@
172
172
 
173
173
  function bookmark() {
174
174
 
175
- if (value === 'on') {
175
+ if (value === bookmark_on) {
176
176
 
177
177
  bookmark_button.value = bookmark_caption;
178
178
 
@@ -184,7 +184,7 @@
184
184
 
185
185
  bookmark_button.value = bookmark_remove_caption;
186
186
 
187
- value = 'on';
187
+ value = bookmark_on;
188
188
 
189
189
  localStorage.setItem(code,value);
190
190
 

3

修正

2019/04/04 14:10

投稿

m.ts10806
m.ts10806

スコア80850

test CHANGED
@@ -176,9 +176,9 @@
176
176
 
177
177
  bookmark_button.value = bookmark_caption;
178
178
 
179
+ value = null;
180
+
179
181
  localStorage.removeItem(code);
180
-
181
- value = null;
182
182
 
183
183
  } else {
184
184
 
@@ -192,8 +192,4 @@
192
192
 
193
193
  }
194
194
 
195
-
196
-
197
-
198
-
199
195
  ```

2

修正

2019/04/04 14:09

投稿

m.ts10806
m.ts10806

スコア80850

test CHANGED
@@ -46,7 +46,7 @@
46
46
 
47
47
 
48
48
 
49
- あとは地道なデバッグです。
49
+ あとは地道な[デバッグ](https://qiita.com/snoguchi/items/8f6bb62a3166eca23ac3)です。
50
50
 
51
51
  処理がどこを通っているかとか、変数の内容とかの確認ですね。
52
52
 

1

画像調整

2019/04/04 14:08

投稿

m.ts10806
m.ts10806

スコア80850

test CHANGED
@@ -92,7 +92,7 @@
92
92
 
93
93
  ```
94
94
 
95
- ![イメージ説明](98e6b7687371e389a238f41ab01ba6e4.png)
95
+ ![イメージ説明](5de61c16baa3939714ba5cff86ed57cb.png)
96
96
 
97
97
  ![イメージ説明](44faef980f9f70bb09dfe5cae8823313.png)
98
98