Pezh commited on
Commit
a75f50b
·
verified ·
1 Parent(s): 0e97623

Create Neo.html

Browse files
Files changed (1) hide show
  1. Neo.html +93 -0
Neo.html ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <style>
6
+ body {
7
+ font-family: Arial, sans-serif;
8
+ }
9
+
10
+ .container {
11
+ max-width: 600px;
12
+ margin: 20px auto;
13
+ padding: 20px;
14
+ border: 1px solid #ccc;
15
+ border-radius: 5px;
16
+ }
17
+
18
+ input[type="text"] {
19
+ width: 100%;
20
+ padding: 10px;
21
+ margin: 10px 0;
22
+ }
23
+
24
+ input[type="checkbox"] {
25
+ margin-right: 10px;
26
+ }
27
+
28
+ .result {
29
+ margin-top: 20px;
30
+ }
31
+
32
+ button {
33
+ padding: 10px 20px;
34
+ background-color: #4CAF50;
35
+ color: white;
36
+ border: none;
37
+ border-radius: 5px;
38
+ cursor: pointer;
39
+ }
40
+
41
+ button:hover {
42
+ background-color: #45a049;
43
+ }
44
+ </style>
45
+ </head>
46
+
47
+ <body>
48
+ <div class="container">
49
+ <input type="text" id="textInput" placeholder="Enter text with ❒ separated words">
50
+ <button onclick="createCheckboxes()">Create Checkboxes</button>
51
+
52
+ <div id="checkboxContainer"></div>
53
+
54
+ <button onclick="showResult()">Result</button>
55
+ <input type="text" id="resultInput">
56
+
57
+ </div>
58
+
59
+ <script>
60
+ function createCheckboxes() {
61
+ var text = document.getElementById("textInput").value;
62
+ var words = text.split("❒");
63
+
64
+ var checkboxContainer = document.getElementById("checkboxContainer");
65
+ checkboxContainer.innerHTML = "";
66
+
67
+ words.forEach(function(word) {
68
+ if (word.trim() !== "") {
69
+ var label = document.createElement("label");
70
+ var checkbox = document.createElement("input");
71
+ checkbox.type = "checkbox";
72
+ checkbox.value = word.trim();
73
+ label.appendChild(checkbox);
74
+ label.appendChild(document.createTextNode(word.trim()));
75
+ checkboxContainer.appendChild(label);
76
+ }
77
+ });
78
+ }
79
+
80
+ function showResult() {
81
+ var checkboxes = document.querySelectorAll("#checkboxContainer input[type='checkbox']");
82
+ var result = [];
83
+ checkboxes.forEach(function(checkbox) {
84
+ if (checkbox.checked) {
85
+ result.push(checkbox.value);
86
+ }
87
+ });
88
+ document.getElementById("resultInput").value = result.join(", ");
89
+ }
90
+ </script>
91
+ </body>
92
+
93
+ </html>