-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
89 lines (76 loc) · 2.89 KB
/
index.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document → ShadowRoot → HTML Controls</title>
</head>
<body>
<h1>Document → ShadowRoot → HTML Controls</h1>
<div id="shadow-host"></div>
<script>
// Create a shadow root
const shadowHost = document.getElementById('shadow-host');
const shadowRoot = shadowHost.attachShadow({ mode: 'open' });
// Create a container for shadow DOM content
const container = document.createElement('div');
// Create and add HTML controls
container.innerHTML = `
<label for="textbox">Textbox:</label>
<input type="text" id="textbox" name="textbox"><br><br>
<label for="checkbox">Checkbox:</label>
<input type="checkbox" id="checkbox" name="checkbox"><br><br>
<label>Radio Buttons:</label>
<input type="radio" id="radio1" name="radio-group" value="1">
<label for="radio1">Option 1</label>
<input type="radio" id="radio2" name="radio-group" value="2">
<label for="radio2">Option 2</label><br><br>
<label for="combobox">Combobox:</label>
<select id="combobox" name="combobox">
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<option value="option3">Option 3</option>
</select><br><br>
<button id="button">Button</button><br><br>
<a href="#">Link</a><br><br>
<label for="listview">List View:</label>
<ul id="listview">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul><br><br>
<select name="drop1" id="Select1" size="4" multiple="multiple">
<option value="1">item 1</option>
<option value="2">item 2</option>
<option value="3">item 3</option>
<option value="4">item 4</option>
<option value="5">item 5</option>
<option value="6">item 6</option>
<option value="7">item 7</option>
<option value="8">All</option>
</select><br><br>
<label for="table">Table:</label>
<table id="table" border="1">
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
<tr>
<td>Data 3</td>
<td>Data 4</td>
</tr>
</tbody>
</table>
`;
// Append the container to the shadow root
shadowRoot.appendChild(container);
</script>
</body>
</html>