moved js code from html to js files
[xynt.git] / prova.html
1 <html>
2 <head>
3 <script type="text/javascript" src="commons.js"></script>
4 <script type="text/javascript" src="xynt-base.js"></script>
5 <script type="text/javascript" src="xynt-dd.js"></script>
6 <script type="text/javascript" src="xynt-link.js"></script>
7 <script type="text/javascript">
8
9 var a = new Array("a", "b", "c", "d");
10 a.delete_element(0);
11                  
12 console.log(a);
13
14 exit;
15
16
17 function Adamo() {
18     this.name = "adamo";
19 }
20
21 Adamo.prototype = {
22     alupa: null,
23
24     pname: function()
25     {
26         console.log("NAME: "+this.name);
27     }
28 }
29
30 function Caino() {
31     this.super.constructor.call(this);
32     this.nname = "caino";
33 }
34
35 Caino.prototype = {
36     gojira: null,
37
38     pname2: function()
39     {
40         console.log("NAME:  "+this.name);
41         console.log("NNAME: "+this.nname);
42     }
43 }
44
45 function Extends_simple(sub, super)
46 {
47     var thinF = function(){};
48     thinF.prototype = super.prototype;
49     var tmp = new thinF();
50
51     for( var f in sub.prototype) {
52         tmp[f] = sub.prototype[f];
53         tmp['constructor'] = sub;
54     }
55     if( super.prototype.constructor == Object.prototype.constructor ){
56         super.prototype.constructor = super;
57     }
58     tmp['super'] = super.prototype;
59     sub.prototype = tmp;
60 }
61
62 Extends_simple(Caino, Adamo);
63
64 var c = new Caino();
65
66 console.log("A "+c.alupa);
67 console.log("G "+c.gojira);
68 console.log("U "+c.unko);
69
70 c.pname();
71 c.pname2();
72
73 function PreA() {
74     this.a_din = "adamo";
75 }
76
77 PreA.prototype = {
78     a_attr: "a attr content",
79     name: "PreA",
80
81     a_func: function()
82     {
83         console.log("A_NAME: "+this.a_din);
84         console.log("A_ATTR: "+this.a_attr);
85     }
86 }
87
88 function A() {
89     PreA.call(this);
90 }
91 A.prototype = {
92     name: "A"
93 }
94 Extends(A, PreA);
95
96 function B() {
97     this.b_din = "bonobo";
98 }
99
100 B.prototype = {
101     name: "B",
102     b_attr: "b attr content",
103
104     b_func: function()
105     {
106         console.log("B_NAME: "+this.b_din);
107         console.log("B_ATTR: "+this.b_attr);
108     }
109 }
110
111 function C() {
112     this.c_din = "canuca";
113 }
114
115 C.prototype = {
116     name: "C",
117     c_attr: "c attr content",
118
119     c_func: function()
120     {
121         console.log("C_NAME: "+this.c_din);
122         console.log("C_ATTR: "+this.c_attr);
123     }
124 }
125
126
127 function Summo() {
128     this.s_name = "caino";
129     A.call(this);
130     B.call(this);
131     C.call(this);
132
133 }
134
135 Summo.prototype = {
136     name: "Summo",
137     s_attr: null,
138
139
140     c_func: function()
141     {
142          console.log("c_func overwrited");
143     },
144
145     s_func: function()
146     {
147          this.a_func();
148          this.b_func();
149          this.c_func();
150          console.log("name: "+this.name);
151     }
152 }
153
154 Extends(Summo, A, B, C);
155
156
157 s_ist = new Summo();
158 s_ist.s_func();
159
160 </script>
161
162 </head>
163 <body>
164 <!-- task:begin -->
165 <div id="board" style="width: 1600; height: 800px; background-color: #f0f0f0; border: 1px solid black; position: relative;">
166   <div id="r1" style="width: 1600; height: 40px; left: 0px; top: 0px; background-color: #e8e8e8; border: 0px solid red; position: absolute;">
167     <div id="t1" style="z-index: 1; left: 10px; top: 10px; width: 100px; height: 21px; border: 1px solid gray; background-color: #c0c0ff; position: absolute;"></div>
168   </div>
169   
170   <div id="r2" style="width: 1600;  left: 0px; top: 40px; height: 40px; background-color: #e8e8ff; border: 0px solid red; position: absolute;">
171     <div id="t2" style="z-index: 1; left: 123px; top: 10px; width: 100px; height: 21px; border: 1px solid gray; background-color: #c0ffc0; position: absolute;"></div>
172   </div>
173
174   <div id="r3" style="width: 1600; height: 40px; left: 0px; top: 80px; background-color: #e8e8e8; border: 0px solid red; position: absolute;">
175     <div id="t3" style="z-index: 1; left: 10px; top: 10px; width: 100px; height: 21px; border: 1px solid gray; background-color: #c0c0ff; position: absolute;"></div>
176   </div>
177   
178   <div id="r4" style="width: 1600;  left: 0px; top: 120px; height: 40px; background-color: #e8e8ff; border: 0px solid red; position: absolute;">
179     <div id="t4" style="z-index: 1; left: 123px; top: 10px; width: 100px; height: 21px; border: 1px solid gray; background-color: #c0ffc0; position: absolute;"></div>
180   </div>
181   
182   <!-- task:end -->
183   
184   
185 </div>
186 </body>
187 </html>