質問編集履歴
2
①箇所のソースを更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -132,103 +132,53 @@
|
|
132
132
|
|
133
133
|
}
|
134
134
|
|
135
|
+
// ②クッキーに値がセットされていれば値を表示
|
136
|
+
|
137
|
+
function Title() {
|
138
|
+
|
139
|
+
if (getCookie('vstitle')) {
|
140
|
+
|
141
|
+
var vstitle = getCookie('vstitle');
|
142
|
+
|
143
|
+
$("strong.visit").text(vstitle);
|
144
|
+
|
145
|
+
}
|
146
|
+
|
147
|
+
if (getCookie('vstitle2') !=="") {
|
148
|
+
|
149
|
+
var vstitle2 = getCookie('vstitle2');
|
150
|
+
|
151
|
+
$("strong.visit").text(vstitle2);
|
152
|
+
|
153
|
+
}
|
154
|
+
|
155
|
+
else{}
|
156
|
+
|
157
|
+
}
|
158
|
+
|
159
|
+
// ①複数のtitleの内容を記憶する
|
135
160
|
|
136
161
|
|
137
162
|
|
163
|
+
function TitleWrite() {
|
138
164
|
|
139
|
-
|
165
|
+
var wrtName = document.getElementsByClassName('title');
|
140
166
|
|
141
|
-
|
167
|
+
var vs = wrtName[0].textContent;
|
142
168
|
|
143
|
-
function Title() {
|
144
|
-
|
145
|
-
|
169
|
+
setCookie('vstitle', vs, 7);
|
146
|
-
|
147
|
-
var vstitle1 = getCookie('vstitle1');
|
148
|
-
|
149
|
-
$("strong.visit").append('<li><a>' + vstitle1 +'</a></li>');
|
150
|
-
|
151
|
-
}
|
152
|
-
|
153
|
-
if (getCookie('vstitle2') !=="") {
|
154
|
-
|
155
|
-
var vstitle2 = getCookie('vstitle2');
|
156
|
-
|
157
|
-
$("strong.visit").append('<li><a>' + vstitle2 +'</a></li>');
|
158
|
-
|
159
|
-
}
|
160
|
-
|
161
|
-
if (getCookie('vstitle3') !=="") {
|
162
|
-
|
163
|
-
var vstitle3 = getCookie('vstitle3');
|
164
|
-
|
165
|
-
$("strong.visit").append('<li><a>' + vstitle3 +'</a></li>');
|
166
|
-
|
167
|
-
}
|
168
170
|
|
169
171
|
|
170
172
|
|
171
|
-
|
173
|
+
var vs1 = wrtName[1].textContent;
|
172
174
|
|
175
|
+
setCookie('vstitle', vs1, 7);
|
176
|
+
|
173
|
-
|
177
|
+
}
|
178
|
+
|
179
|
+
</script>
|
174
180
|
|
175
181
|
|
176
|
-
|
177
|
-
// ①複数のtitleの内容を記憶する
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
function TitleWrite() {
|
182
|
-
|
183
|
-
cond[n]();
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
var cond = [
|
190
|
-
|
191
|
-
function(){
|
192
|
-
|
193
|
-
var vstitle01 = document.getElementsByClassName('title').textContent;
|
194
|
-
|
195
|
-
setCookie('vstitle1', vstitle1, 7);
|
196
|
-
|
197
|
-
},
|
198
|
-
|
199
|
-
function(){
|
200
|
-
|
201
|
-
var vstitle02 = document.getElementsByClassName('title').textContent;
|
202
|
-
|
203
|
-
setCookie('vstitle2', vstitle2, 7);
|
204
|
-
|
205
|
-
},
|
206
|
-
|
207
|
-
function(){
|
208
|
-
|
209
|
-
var vstitle03 = document.getElementsByClassName('title').textContent;
|
210
|
-
|
211
|
-
setCookie('vstitle3', vstitle3, 7);
|
212
|
-
|
213
|
-
}
|
214
|
-
|
215
|
-
]
|
216
|
-
|
217
|
-
indow.alert('保存しました'); // 警告ダイアログを表示
|
218
|
-
|
219
|
-
}
|
220
|
-
|
221
|
-
$(function () {
|
222
|
-
|
223
|
-
Title();
|
224
|
-
|
225
|
-
});
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
</script>
|
232
182
|
|
233
183
|
</head>
|
234
184
|
|
@@ -236,11 +186,7 @@
|
|
236
186
|
|
237
187
|
<h2 class="title">titleを記録</h2>
|
238
188
|
|
239
|
-
<h2 class="title">title02を記録</h2>
|
240
|
-
|
241
|
-
<h2 class="title">title03を記録</h2>
|
242
|
-
|
243
|
-
<
|
189
|
+
<ul><strong class="visit"></strong></ul>
|
244
190
|
|
245
191
|
<button id="setButton" onclick="TitleWrite();">保存</button>
|
246
192
|
|
1
idをクラス名に変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -146,29 +146,29 @@
|
|
146
146
|
|
147
147
|
var vstitle1 = getCookie('vstitle1');
|
148
148
|
|
149
|
-
|
149
|
+
$("strong.visit").append('<li><a>' + vstitle1 +'</a></li>');
|
150
|
-
|
150
|
+
|
151
|
-
}
|
151
|
+
}
|
152
|
-
|
152
|
+
|
153
|
-
|
153
|
+
if (getCookie('vstitle2') !=="") {
|
154
154
|
|
155
155
|
var vstitle2 = getCookie('vstitle2');
|
156
156
|
|
157
|
-
|
157
|
+
$("strong.visit").append('<li><a>' + vstitle2 +'</a></li>');
|
158
|
-
|
158
|
+
|
159
|
-
}
|
159
|
+
}
|
160
|
-
|
160
|
+
|
161
|
-
|
161
|
+
if (getCookie('vstitle3') !=="") {
|
162
162
|
|
163
163
|
var vstitle3 = getCookie('vstitle3');
|
164
164
|
|
165
|
-
|
165
|
+
$("strong.visit").append('<li><a>' + vstitle3 +'</a></li>');
|
166
|
-
|
166
|
+
|
167
|
-
}
|
167
|
+
}
|
168
|
-
|
169
|
-
|
170
|
-
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
-
|
171
|
+
else{}
|
172
172
|
|
173
173
|
}
|
174
174
|
|
@@ -176,41 +176,41 @@
|
|
176
176
|
|
177
177
|
// ①複数のtitleの内容を記憶する
|
178
178
|
|
179
|
-
|
180
|
-
|
179
|
+
|
180
|
+
|
181
|
-
|
181
|
+
function TitleWrite() {
|
182
|
-
|
182
|
+
|
183
|
-
|
183
|
+
cond[n]();
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
-
|
189
|
+
var cond = [
|
190
|
-
|
190
|
+
|
191
|
-
|
191
|
+
function(){
|
192
|
-
|
192
|
+
|
193
|
-
|
193
|
+
var vstitle01 = document.getElementsByClassName('title').textContent;
|
194
|
-
|
194
|
+
|
195
|
-
|
195
|
+
setCookie('vstitle1', vstitle1, 7);
|
196
|
-
|
196
|
+
|
197
|
-
|
197
|
+
},
|
198
|
-
|
198
|
+
|
199
|
-
|
199
|
+
function(){
|
200
|
-
|
200
|
+
|
201
|
-
|
201
|
+
var vstitle02 = document.getElementsByClassName('title').textContent;
|
202
|
-
|
202
|
+
|
203
|
-
|
203
|
+
setCookie('vstitle2', vstitle2, 7);
|
204
|
-
|
204
|
+
|
205
|
-
|
205
|
+
},
|
206
|
-
|
206
|
+
|
207
|
-
|
207
|
+
function(){
|
208
|
-
|
208
|
+
|
209
|
-
|
209
|
+
var vstitle03 = document.getElementsByClassName('title').textContent;
|
210
|
-
|
210
|
+
|
211
|
-
|
211
|
+
setCookie('vstitle3', vstitle3, 7);
|
212
|
-
|
212
|
+
|
213
|
-
|
213
|
+
}
|
214
214
|
|
215
215
|
]
|
216
216
|
|
@@ -224,7 +224,7 @@
|
|
224
224
|
|
225
225
|
});
|
226
226
|
|
227
|
-
|
227
|
+
|
228
228
|
|
229
229
|
|
230
230
|
|
@@ -234,11 +234,11 @@
|
|
234
234
|
|
235
235
|
<body>
|
236
236
|
|
237
|
-
<h2
|
237
|
+
<h2 class="title">titleを記録</h2>
|
238
|
-
|
238
|
+
|
239
|
-
<h2
|
239
|
+
<h2 class="title">title02を記録</h2>
|
240
|
-
|
240
|
+
|
241
|
-
<h2
|
241
|
+
<h2 class="title">title03を記録</h2>
|
242
242
|
|
243
243
|
<p><strong class="visit"></strong></p>
|
244
244
|
|