質問編集履歴
2
スペルの誤入力
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,14 +7,14 @@
|
|
7
7
|
### 該当のソースコード
|
8
8
|
```html```html
|
9
9
|
<div id="bookmark">
|
10
|
-
<input type="button" name="" value="この記事をブックマーク" onclick="bookmark()" id="
|
10
|
+
<input type="button" name="" value="この記事をブックマーク" onclick="bookmark()" id="bookmark">
|
11
11
|
</div>
|
12
12
|
```
|
13
13
|
```Javascript```JavaScript
|
14
14
|
var code = 'bookmark438591'
|
15
15
|
var value = localStorage.getItem(code);
|
16
16
|
if (value === 'on') {
|
17
|
-
document.getElementById('
|
17
|
+
document.getElementById('bookmark').value = 'ブックマークを解除';
|
18
18
|
function bookmark(){
|
19
19
|
localStorage.removeItem(code);
|
20
20
|
}
|
@@ -22,7 +22,7 @@
|
|
22
22
|
else {
|
23
23
|
function bookmark(){
|
24
24
|
localStorage.setItem(code, 'on');
|
25
|
-
document.getElementById('
|
25
|
+
document.getElementById('bookmark').value = 'ブックマークを解除';
|
26
26
|
}
|
27
27
|
}
|
28
28
|
```
|
1
スペルはミスです。onclick=""は大丈夫だったのですが...
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,14 +7,14 @@
|
|
7
7
|
### 該当のソースコード
|
8
8
|
```html```html
|
9
9
|
<div id="bookmark">
|
10
|
-
<input type="button" name="" value="この記事をブックマーク" onclick="bookmark()" id="
|
10
|
+
<input type="button" name="" value="この記事をブックマーク" onclick="bookmark()" id="bookumark">
|
11
11
|
</div>
|
12
12
|
```
|
13
13
|
```Javascript```JavaScript
|
14
14
|
var code = 'bookmark438591'
|
15
15
|
var value = localStorage.getItem(code);
|
16
16
|
if (value === 'on') {
|
17
|
-
document.getElementById('
|
17
|
+
document.getElementById('bookumark').value = 'ブックマークを解除';
|
18
18
|
function bookmark(){
|
19
19
|
localStorage.removeItem(code);
|
20
20
|
}
|
@@ -22,7 +22,7 @@
|
|
22
22
|
else {
|
23
23
|
function bookmark(){
|
24
24
|
localStorage.setItem(code, 'on');
|
25
|
-
document.getElementById('
|
25
|
+
document.getElementById('bookumark').value = 'ブックマークを解除';
|
26
26
|
}
|
27
27
|
}
|
28
28
|
```
|
@@ -34,5 +34,4 @@
|
|
34
34
|
### 補足情報
|
35
35
|
|
36
36
|
Chrome最新版でやってます。
|
37
|
-
ローカルストレージの内容を読み取って表示するページはできています。
|
37
|
+
ローカルストレージの内容を読み取って表示するページはできています。
|
38
|
-
jqueryは使わないでください。
|