Commit 12945394 authored by Téo Vasseur's avatar Téo Vasseur

css/js : set view id, and use as inner text

parent d73867ef
......@@ -81,6 +81,9 @@ div {
}
.view {
font-size: 2em;
text-align: center;
color: white;
min-width: 400px;
min-height: 200px;
border: 3px solid #ccc;
......
function View(parentId, classes) {
function View(id, parentId, classes) {
this.parentId = parentId;
this.id = id;
var parent = document.getElementById(parentId);
var view = document.createElement('div');
view.className = "view " + classes;
view.textContent = id;
parent.appendChild(view);
}
function Flex(parentId) {
View.call(this, parentId, "flex");
function Flex(id, parentId) {
View.call(this, id, parentId, "flex");
}
function Solid1(parentId) {
View.call(this, parentId, "solid1");
function Solid1(id, parentId) {
View.call(this, id, parentId, "solid1");
}
function Solid2(parentId) {
View.call(this, parentId, "solid2");
function Solid2(id, parentId) {
View.call(this, id, parentId, "solid2");
}
function main() {
// new Flex('A');
new Flex('A');
new Flex('B');
new Flex('C');
new Flex("v1", 'A');
// new Flex("v2", 'A');
new Flex("v3", 'B');
new Flex("v4", 'C');
new Solid1('A');
new Solid2('B');
new Solid1("v5", 'A');
new Solid2("v6", 'B');
}
main();
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment