-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinnerHTML.html
More file actions
43 lines (40 loc) · 1.56 KB
/
innerHTML.html
File metadata and controls
43 lines (40 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>innerHTML</title>
</head>
<body>
<h1>innerHTMLのサンプル</h1>
<div id="container1">元のテキスト</div>
<div id="container2"><a href="http://www.example.com">example.com</a></div>
<div id="container3">
<h2>元のタイトル</h2>
<ol>
<li>a</li>
<li>b</li>
<li>c</li>
</ol>
</div>
<script>
// const container1 = document.getElementById("container1");
// const container2 = document.getElementById("container2");
// const container3 = document.getElementById("container3");
// // テキストのみの文書
// container1.innerHTML = "湘南ハイテク企画";
// // 1つのアンカータグのみの文書
// container2.innerHTML = '<a href="https://www.sh-k.com/">湘南ハイテク企画</>';
// // 並列関係にある2つのタグとそのうちのひとつが階層構造をもつ文書
// container3.innerHTML = `
// <h2>湘南ハイテク企画のWebサイト構造</h2>
// <ul>
// <li><a href='https://www.sh-k.com/'>ホーム</li>
// <li><a href='https://www.sh-k.com/education'>教育研修サービス</li>
// <li><a href='https://www.sh-k.com/support'>就業サポート</li>
// <li><a href='https://www.sh-k.com/company'>企業情報</li>
// </ul>
// `;
</script>
</body>
</html>