-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
115 lines (113 loc) · 4.38 KB
/
index.html
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!DOCTYPE html>
<html>
<head>
<title>Tristate Checkbox</title>
<link rel="stylesheet" type="text/css" href="tristate-checkbox.css" media="screen">
<script type="text/javascript" src="lib/prototype/prototype.js"></script>
<script type="text/javascript" src="lib/scriptaculous/scriptaculous.js"></script>
<script type="text/javascript" src="tristate-checkbox.js"></script>
</head>
<body>
<div style="margin:10px; padding: 5px; border-radius: 5px; border: 1px solid #aaa">
<h1>Description</h1>
<p>
The <code>TristateCheckbox</code> allows any checkbox element to have an extra state defined.
this state means that some of it's children are selected, but not all of them
</p>
<p>
This gets determined by a built in <code>dependencySelector</code>.
it is customizable to almost any context
</p>
<p>
one tristate can even set the state of another, this is all built in via events
</p>
<h2>Basic Usage</h2>
<p>
<form id="basic-usage">
<table>
<tr>
<td>Basic tri-state (has little to no function like this) : </td>
<td>
<input id="cb-1" type="checkbox"/>
</td>
</tr>
</table>
</form>
<script>
document.observe('dom:loaded', function() {
new TriStateCheckbox('cb-1');
});
</script>
<br/>
<pre>
<b>markup</b>
<code>
<input id="cb-1" type="checkbox"/>
</code>
<b>script</b>
<code>
document.observe('dom:loaded', function() {
new TriStateCheckbox('cb-1');
});
</code>
</pre>
</p>
<h2>Advanced Usage</h2>
<p>
<form id="adv-usage">
<table>
<tr>
<td>normal tri-state : </td>
<td>
<input id="cb-a-1" type="checkbox"/>
</td>
</tr>
<tr>
<td>child 1 : </td>
<td>
<input id="cb-c-1" type="checkbox"/>
</td>
</tr>
<tr>
<td>child 2 : </td>
<td>
<input id="cb-c-2" type="checkbox"/>
</td>
</tr>
<tr>
<td>child 3 : </td>
<td>
<input id="cb-c-3" type="checkbox"/>
</td>
</tr>
</table>
</form>
<script>
document.observe('dom:loaded', function() {
new TriStateCheckbox('cb-a-1', {
dependantSelector: 'form#adv-usage input[id^="cb-c"]'
});
});
</script>
<br/>
<pre>
<b>markup</b>
<code>
<input id="cb-a-1" type="checkbox"/>
<input id="cb-c-1" type="checkbox"/>
<input id="cb-c-2" type="checkbox"/>
<input id="cb-c-3" type="checkbox"/>
</code>
<b>script</b>
<code>
document.observe('dom:loaded', function() {
new TriStateCheckbox('cb-a-1', {
dependantSelector: 'form#adv-usage input[id^="cb-c"]'
});
});
</code>
</pre>
</p>
</div>
</body>
</html>