-
Notifications
You must be signed in to change notification settings - Fork 0
/
example1_dodl.js
92 lines (84 loc) · 1.56 KB
/
example1_dodl.js
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
90
91
92
/*
class RedSquare
{
attributes:
class=@'blackborder'@,
behaviors:
setOnClick()
@{
var node=document.getElementById('RedSquare_'+id);
node.setAttribute('onclick','window.RedSquare.changeColor('+id+')')
}@
,
changeColor()
@{
var node=document.getElementById('RedSquare_'+id);
node.setAttribute('class','redborder');
}@
inner_tree:
}
*/
var redsquare_construct="\
class RedSquare\
{\
attributes:\
class=@'blackborder'@\
\
behaviors:\
setOnClick()\
@{\
var node=document.getElementById('RedSquare_'+id);\
node.setAttribute('onclick','window.RedSquare.changeColor('+id+')')\
}@\
,\
changeColor()\
@{\
var node=document.getElementById('RedSquare_'+id);\
node.setAttribute('class','redborder');\
}@\
\
inner_tree:\
}";
/*
class BlueSquare
{
attributes:
class=@'blackborder'@,
behaviors:
setOnClick()
@{
var node=document.getElementById('BlueSquare_'+id);
node.setAttribute('onclick','window.BlueSquare.changeColor('+id+')')
}@
,
changeColor()
@{
var node=document.getElementById('BlueSquare_'+id);
node.setAttribute('class','blueborder');
}@
inner_tree:
}
*/
var bluesquare_construct="\
class BlueSquare\
{\
attributes:\
class=@'blackborder'@,\
\
behaviors:\
setOnClick()\
@{\
var node=document.getElementById('BlueSquare_'+id);\
node.setAttribute('onclick','window.BlueSquare.changeColor('+id+')')\
}@\
,\
changeColor()\
@{\
var node=document.getElementById('BlueSquare_'+id);\
node.setAttribute('class','blueborder');\
}@\
\
inner_tree:\
}";
dodl_load(redsquare_construct);
dodl_load(bluesquare_construct);