質問編集履歴
1
修正したものと質問を追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -367,3 +367,311 @@
|
|
367
367
|
</html>
|
368
368
|
|
369
369
|
```
|
370
|
+
|
371
|
+
|
372
|
+
|
373
|
+
###修正後
|
374
|
+
|
375
|
+
ご回答を受けて、修正したものを掲載します。
|
376
|
+
|
377
|
+
```HTML
|
378
|
+
|
379
|
+
<!DOCTYPE html>
|
380
|
+
|
381
|
+
<html lang = "ja">
|
382
|
+
|
383
|
+
<head>
|
384
|
+
|
385
|
+
<meta charset= "utf-8">
|
386
|
+
|
387
|
+
<title>サンプルページ</title>
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
</head>
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
<body id = "body">
|
396
|
+
|
397
|
+
<header id = "header">
|
398
|
+
|
399
|
+
</header>
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
<nav id="dropdown" class ="dropdown">
|
404
|
+
|
405
|
+
<ul>
|
406
|
+
|
407
|
+
<li><a href ="no1.html" id = "no1"></a></li>
|
408
|
+
|
409
|
+
<li><a href ="no2.html" id = "no2"></a></li>
|
410
|
+
|
411
|
+
<li><a href ="no3.html">その3</a></li>
|
412
|
+
|
413
|
+
</ul>
|
414
|
+
|
415
|
+
</nav>
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
<article id="article">
|
420
|
+
|
421
|
+
<h2 id = "contents1"></h2>
|
422
|
+
|
423
|
+
<p id = "sentence1"></p>
|
424
|
+
|
425
|
+
<br>
|
426
|
+
|
427
|
+
<h2>内容2</h2>
|
428
|
+
|
429
|
+
<p id = "paragraph1">行1
|
430
|
+
|
431
|
+
<br>行2
|
432
|
+
|
433
|
+
<br>行3</p>
|
434
|
+
|
435
|
+
<br>
|
436
|
+
|
437
|
+
<h3>内容3</h3>
|
438
|
+
|
439
|
+
<p id = "paragraph2">行1
|
440
|
+
|
441
|
+
<br>行2</p>
|
442
|
+
|
443
|
+
<ul>
|
444
|
+
|
445
|
+
<ol>
|
446
|
+
|
447
|
+
<li>項目1</li>
|
448
|
+
|
449
|
+
<li>項目2</li>
|
450
|
+
|
451
|
+
</ol>
|
452
|
+
|
453
|
+
</ul>
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
<form>
|
458
|
+
|
459
|
+
<h2>フォーム</h2>
|
460
|
+
|
461
|
+
<div>
|
462
|
+
|
463
|
+
<lavel id = "name"><input type="text" size="15" name="name"></lavel><br>
|
464
|
+
|
465
|
+
<label>問い合わせ内容:<input type="text" size="20" name="question"></label><br>
|
466
|
+
|
467
|
+
<input type="submit" value="submit">
|
468
|
+
|
469
|
+
</div>
|
470
|
+
|
471
|
+
</form>
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
</article>
|
476
|
+
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
<footer id = "footer">
|
482
|
+
|
483
|
+
<ul>
|
484
|
+
|
485
|
+
<a href ="page1.html" id = "other1"></a>
|
486
|
+
|
487
|
+
<a href ="page2.html" id = "other2"></a>
|
488
|
+
|
489
|
+
</ul>
|
490
|
+
|
491
|
+
<small id = "copyright"></small>
|
492
|
+
|
493
|
+
</footer>
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
<!-- JavaScriptでDOM指定 -->
|
498
|
+
|
499
|
+
<script>
|
500
|
+
|
501
|
+
var body = document.getElementById("body");
|
502
|
+
|
503
|
+
var header = document.getElementById("header");
|
504
|
+
|
505
|
+
var h1 = document.createElement('h1');
|
506
|
+
|
507
|
+
h1.textContent = "サンプルページ";
|
508
|
+
|
509
|
+
header.appendChild(h1);
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
var nav = document.getElementById("dropdown");
|
514
|
+
|
515
|
+
var h2 = document.createElement("h2");
|
516
|
+
|
517
|
+
h2.textContent = "メニュー";
|
518
|
+
|
519
|
+
nav.appendChild(h2);
|
520
|
+
|
521
|
+
var no1 = document.getElementById("no1");
|
522
|
+
|
523
|
+
no1.textContent = "その1";
|
524
|
+
|
525
|
+
nav.appendChild(no1);
|
526
|
+
|
527
|
+
var no2 = document.getElementById("no2");
|
528
|
+
|
529
|
+
no2.textContent = "その2";
|
530
|
+
|
531
|
+
nav.appendChild(no2);
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
var article = document.getElementById("article");
|
536
|
+
|
537
|
+
var contents1 = document.createElement("contents1");
|
538
|
+
|
539
|
+
contents1.textContent = "内容1";
|
540
|
+
|
541
|
+
article.appendChild(contents1);
|
542
|
+
|
543
|
+
var sentence1 = document.createElement("sentence1");
|
544
|
+
|
545
|
+
sentence1.textContent = "文章1";
|
546
|
+
|
547
|
+
article.appendChild(sentence1);
|
548
|
+
|
549
|
+
|
550
|
+
|
551
|
+
var form = document.getElementById("form");
|
552
|
+
|
553
|
+
form.textContent = "フォーム";
|
554
|
+
|
555
|
+
article.appendChild(form);
|
556
|
+
|
557
|
+
var name = document.getElementById("name");
|
558
|
+
|
559
|
+
name.textContent = "氏名:";
|
560
|
+
|
561
|
+
form.appendChild(name);
|
562
|
+
|
563
|
+
|
564
|
+
|
565
|
+
var footer = document.getElementById("footer");
|
566
|
+
|
567
|
+
var other1 = document.getElementById("other1");
|
568
|
+
|
569
|
+
other1.textContent = "他のページ1";
|
570
|
+
|
571
|
+
footer.appendChild(other1);
|
572
|
+
|
573
|
+
var other2 = document.getElementById("other2");
|
574
|
+
|
575
|
+
other2.textContent = "他のページ2";
|
576
|
+
|
577
|
+
footer.appendChild(other2);
|
578
|
+
|
579
|
+
var copyright = document.getElementById("copyright");
|
580
|
+
|
581
|
+
copyright.textContent = "Copyright © ";
|
582
|
+
|
583
|
+
footer.appendChild(copyright);
|
584
|
+
|
585
|
+
|
586
|
+
|
587
|
+
</script>
|
588
|
+
|
589
|
+
|
590
|
+
|
591
|
+
</body>
|
592
|
+
|
593
|
+
</html>
|
594
|
+
|
595
|
+
```
|
596
|
+
|
597
|
+
|
598
|
+
|
599
|
+
|
600
|
+
|
601
|
+
|
602
|
+
|
603
|
+
<nav>, <form>, <footer>部分で元々のHTMLファイルと同様に表示されないという問題が発生しています。
|
604
|
+
|
605
|
+
|
606
|
+
|
607
|
+
<nav>の部分で全て一行で表示され、改行ができていないことに加え、HTMLの<li>タグにより「・」のみが表示されています。
|
608
|
+
|
609
|
+
```
|
610
|
+
|
611
|
+
var no1 = document.getElementById("no1");
|
612
|
+
|
613
|
+
no1.textContent = "その1";
|
614
|
+
|
615
|
+
nav.appendChild(no1);
|
616
|
+
|
617
|
+
var no2 = document.getElementById("no2");
|
618
|
+
|
619
|
+
no2.textContent = "その2";
|
620
|
+
|
621
|
+
nav.appendChild(no2);
|
622
|
+
|
623
|
+
```
|
624
|
+
|
625
|
+
|
626
|
+
|
627
|
+
<form>の部分では<input type="text">によりフォームの入力窓のみが表示されている状態です。
|
628
|
+
|
629
|
+
```
|
630
|
+
|
631
|
+
|
632
|
+
|
633
|
+
var form = document.getElementById("form");
|
634
|
+
|
635
|
+
form.textContent = "フォーム";
|
636
|
+
|
637
|
+
article.appendChild(form);
|
638
|
+
|
639
|
+
var name = document.getElementById("name");
|
640
|
+
|
641
|
+
name.textContent = "氏名:";
|
642
|
+
|
643
|
+
form.appendChild(name);
|
644
|
+
|
645
|
+
```
|
646
|
+
|
647
|
+
|
648
|
+
|
649
|
+
|
650
|
+
|
651
|
+
<footer>部分の表示が全て一行で表示され、改行ができていません。
|
652
|
+
|
653
|
+
```
|
654
|
+
|
655
|
+
var footer = document.getElementById("footer");
|
656
|
+
|
657
|
+
var other1 = document.getElementById("other1");
|
658
|
+
|
659
|
+
other1.textContent = "他のページ1";
|
660
|
+
|
661
|
+
footer.appendChild(other1);
|
662
|
+
|
663
|
+
var other2 = document.getElementById("other2");
|
664
|
+
|
665
|
+
other2.textContent = "他のページ2";
|
666
|
+
|
667
|
+
footer.appendChild(other2);
|
668
|
+
|
669
|
+
var copyright = document.getElementById("copyright");
|
670
|
+
|
671
|
+
copyright.textContent = "Copyright © ";
|
672
|
+
|
673
|
+
footer.appendChild(copyright);
|
674
|
+
|
675
|
+
```
|
676
|
+
|
677
|
+
他のページ1他のページ2Copyright ©
|