回答編集履歴

3

補足追加

2019/01/29 06:30

投稿

退会済みユーザー
test CHANGED
@@ -357,3 +357,15 @@
357
357
 
358
358
 
359
359
  ```
360
+
361
+
362
+
363
+ ### 回答追加 1/29 15:30
364
+
365
+ 「なぜparentが三つなのか?」
366
+
367
+ chromeブラウザの検証ツールで確認できます。
368
+
369
+ 実際に見てみるとiframeが何重にもなっているのが分かります。
370
+
371
+ ![iframe確認](98f9c753d9a2ab5d394accb78a87fca0.png)

2

誤記修正

2019/01/29 06:30

投稿

退会済みユーザー
test CHANGED
@@ -272,9 +272,9 @@
272
272
 
273
273
  <ul>
274
274
 
275
- <li><button onclick="openUrl('a')">a</button></li>
275
+ <li><button onclick="openUrl('a')">ページa</button></li>
276
-
276
+
277
- <li><button onclick="openUrl('b')">a</button></li>
277
+ <li><button onclick="openUrl('b')">ページb</button></li>
278
278
 
279
279
  </ul>
280
280
 
@@ -328,9 +328,9 @@
328
328
 
329
329
  <ul>
330
330
 
331
- <li><button onclick="openUrl('a')">a</button></li>
331
+ <li><button onclick="openUrl('a')">ページa</button></li>
332
-
332
+
333
- <li><button onclick="openUrl('b')">a</button></li>
333
+ <li><button onclick="openUrl('b')">ページb</button></li>
334
334
 
335
335
  </ul>
336
336
 

1

回答追加

2019/01/29 03:37

投稿

退会済みユーザー
test CHANGED
@@ -155,3 +155,205 @@
155
155
  ```
156
156
 
157
157
  補足:location.replaceはあってもなくても動作が一緒でした。(ボタンをおすごとにiframeの内容が切り替わる)
158
+
159
+
160
+
161
+ ---
162
+
163
+
164
+
165
+ ### 回答追加 1/29 12:30
166
+
167
+ 子要素から親要素を編集したいということでしたので修正しました。
168
+
169
+ ```GoogleAppScript
170
+
171
+ ファイル名:コード.gs
172
+
173
+
174
+
175
+ function doGet(e){
176
+
177
+ var page = e.parameter["p"];
178
+
179
+ if(page == "index" || page == null){
180
+
181
+ var htmlOutput = HtmlService.createTemplateFromFile("index.html").evaluate();
182
+
183
+ return htmlOutput;
184
+
185
+ }
186
+
187
+ else if(page == "a"){
188
+
189
+ var htmloutput = HtmlService.createTemplateFromFile('a.html').evaluate();
190
+
191
+ htmloutput.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
192
+
193
+ return htmloutput;
194
+
195
+ }
196
+
197
+ else if(page == "b"){
198
+
199
+ var htmloutput = HtmlService.createTemplateFromFile('b.html').evaluate();
200
+
201
+ htmloutput.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
202
+
203
+ return htmloutput;
204
+
205
+ }
206
+
207
+ }
208
+
209
+ ```
210
+
211
+
212
+
213
+
214
+
215
+ ```html
216
+
217
+ ファイル名:index.html
218
+
219
+
220
+
221
+ <!DOCTYPE html>
222
+
223
+ <html>
224
+
225
+ <head>
226
+
227
+ <base target="_top">
228
+
229
+ </head>
230
+
231
+ <body>
232
+
233
+ index
234
+
235
+
236
+
237
+ <iframe id="ifrmencont" src="https://script.google.com/macros/s/AKfycbwyzkUAatP4KABhkXs7zn0SIwFMfrdJ9GEWokWhv-11ySHR191N/exec?p=a" frameborder="0" scrolling="no"></iframe>
238
+
239
+ </body>
240
+
241
+ </html>
242
+
243
+
244
+
245
+ ```
246
+
247
+
248
+
249
+ ```html
250
+
251
+ ファイル名:a.html
252
+
253
+
254
+
255
+ <!DOCTYPE html>
256
+
257
+ <html>
258
+
259
+ <head>
260
+
261
+ <base target="_top">
262
+
263
+ </head>
264
+
265
+ <body>
266
+
267
+ aaaaaaaaaaaaaaa
268
+
269
+ <div>
270
+
271
+ menu
272
+
273
+ <ul>
274
+
275
+ <li><button onclick="openUrl('a')">a</button></li>
276
+
277
+ <li><button onclick="openUrl('b')">a</button></li>
278
+
279
+ </ul>
280
+
281
+ </div>
282
+
283
+ <script>
284
+
285
+ function openUrl(param){
286
+
287
+ var ifrmencont = window.parent.parent.parent.document.getElementById('ifrmencont');
288
+
289
+ console.log(ifrmencont);
290
+
291
+ ifrmencont.src = 'https://script.google.com/macros/s/AKfycbwyzkUAatP4KABhkXs7zn0SIwFMfrdJ9GEWokWhv-11ySHR191N/exec?p=' + param;
292
+
293
+ }
294
+
295
+ </script>
296
+
297
+ </body>
298
+
299
+ </html>
300
+
301
+ ```
302
+
303
+
304
+
305
+ ```html
306
+
307
+ ファイル名:b.html
308
+
309
+
310
+
311
+ <!DOCTYPE html>
312
+
313
+ <html>
314
+
315
+ <head>
316
+
317
+ <base target="_top">
318
+
319
+ </head>
320
+
321
+ <body>
322
+
323
+ bbbbbbbbbbbbbbb
324
+
325
+ <div>
326
+
327
+ menu
328
+
329
+ <ul>
330
+
331
+ <li><button onclick="openUrl('a')">a</button></li>
332
+
333
+ <li><button onclick="openUrl('b')">a</button></li>
334
+
335
+ </ul>
336
+
337
+ </div>
338
+
339
+ <script>
340
+
341
+ function openUrl(param){
342
+
343
+ var ifrmencont = window.parent.parent.parent.document.getElementById('ifrmencont');
344
+
345
+ console.log(ifrmencont);
346
+
347
+ ifrmencont.src = 'https://script.google.com/macros/s/AKfycbwyzkUAatP4KABhkXs7zn0SIwFMfrdJ9GEWokWhv-11ySHR191N/exec?p=' + param;
348
+
349
+ }
350
+
351
+ </script>
352
+
353
+ </body>
354
+
355
+ </html>
356
+
357
+
358
+
359
+ ```