added examples

This commit is contained in:
didier amyot committed 2024-01-17 18:44:54 -05:00
1 parent 1f85f8145d
commit 5a6d3b15ac
3 files changed
+38 -1

No files matched your search

+2
View File
@@ -17,5 +17,7 @@
<div id="example-3"></div>
<div id="example-4"></div>
</body>
</html>
+22 -1
View File
@@ -1,4 +1,4 @@
import m from "https://esm.sh/mithril@2.2.2"
import m from "https://esm.sh/mithril@2.2.2";
function example1(){
let div1 = m("b", {style: "font-family: monospace;"}, "didier");
@@ -26,3 +26,24 @@ function example3(){
}
m.render(document.getElementById("example-3"), example3());
function exemple4(){
const subList = m("ol",
m("li", "unos"),
m("li", "dos"),
m("li", "tres"));
const lst = m("ul",
m("li", "un"),
m("li", "deux"),
m("li", subList));
const form = m("form",
m("label", "X: ", m("input", {type: "text"})),
m("label", "Y: ", m("input", {type: "text"})),
m("button", "envoyer!")
);
return m("div", lst, form);
}
const root = document.getElementById("example-4")
m.render(root, exemple4());