/[suikacvs]/www/test/misc/jswidgets/values/values-2.html
Suika

Contents of /www/test/misc/jswidgets/values/values-2.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download) (as text)
Sun Dec 21 08:18:10 2008 UTC (16 years, 7 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/html
New

1 wakaba 1.1 <!DOCTYPE HTML>
2     <title>widget-values.js</title>
3     <script src="http://suika.fam.cx/www/style/ui/widget-values.js.u8" charset=utf-8></script>
4     <script>
5     function MyNumbersWidget (c) {
6     WidgetValues.apply (this, [c]);
7     }
8    
9     MyNumbersWidget.prototype = new WidgetValues;
10    
11     MyNumbersWidget.prototype.createField = function (value) {
12     var field = document.createElement ('span');
13     field.wvIsField = true;
14    
15     var input = document.createElement ('input');
16     input.setAttribute ('type', 'number');
17     input.setAttribute ('min', 1);
18     input.setAttribute ('max', 10);
19     input.value = value;
20     field.appendChild (input);
21    
22     return field;
23     };
24    
25     MyNumbersWidget.prototype.clear = function () {
26     var self = this;
27    
28     this._clear ();
29    
30     var fields = document.createElement ('span');
31     this.container.appendChild (fields);
32     this.fieldsParent = fields;
33    
34     var addButton = this.createButton ();
35     addButton.innerHTML = '+';
36     addButton.onclick = function () { self.appendValues ([5]) };
37     this.container.appendChild (addButton);
38     };
39    
40     window.onload = function () {
41     new MyNumbersWidget (document.getElementById ('c'));
42     }; // onload
43     </script>
44    
45     <p><span id=c data-widget-name=test>
46     <textarea name=tests>5 0 3</textarea>
47     </span>

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24