/[bfilter]/trunk/combo.html
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/combo.html

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 11 by dpavlin, Fri Sep 10 12:42:58 2004 UTC revision 24 by dpavlin, Tue Sep 14 22:55:40 2004 UTC
# Line 1  Line 1 
1  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2  <HTML>  <HTML>
3  <HEAD>  <HEAD>
4  <TITLE> New Document </TITLE>  <TITLE>Combobox example</TITLE>
5    
6  <style type="text/css">  <style type="text/css">
7  #textfilterholder {  #textfilterholder {
# Line 38  z-index:10; Line 38  z-index:10;
38    
39    
40  <script type="text/javascript" src="bfilter.js"></script>  <script type="text/javascript" src="bfilter.js"></script>
41    <script type="text/javascript" src="combo-test.js"></script>
42  <script type="text/javascript">  <script type="text/javascript">
43    
44  var headlines = new Object();  var combo_active = 1;
45  headlines['ad'] = [  
46    ['thes/232.html','adacta']  function combo_onKeyDown(event) {
47  , ['thes/232.html','added']          //debug("event: "+event.keyCode);
48  , ['thes/232.html','addenda']          if (event.keyCode == 13) {
49  , ['thes/232.html','adlib']                  var el = document.myfilter.element_id('textfilter');
50  ];                  if (el) el.focus();
51                    
52                    el = document.myfilter.element_id('results');
53                    if (el) el.innerHTML = '';
54            
55                    combo_active = 0;
56            }
57    
58    }
59    
 headlines.min_len = 2;  
 headlines.length = 4;  
60    
61  function myfilter() {  function myfilter() {
62    
63          document.getElementById('textfilter').focus();          document.getElementById('textfilter').focus();
64  document.getElementById('textfilter').caretPos=1;  document.getElementById('textfilter').caretPos=1;
65  //      document.getElementById('textfilter').select();  //      document.getElementById('textfilter').select();
# Line 60  document.getElementById('textfilter').ca Line 68  document.getElementById('textfilter').ca
68          document.myfilter.html_pre = '<option value="';          document.myfilter.html_pre = '<option value="';
69          document.myfilter.html_mid = '">';          document.myfilter.html_mid = '">';
70          document.myfilter.html_post = '</option>';          document.myfilter.html_post = '</option>';
71          document.myfilter.html_full_pre = '<select id="sel" size="5" onkeydown="if (event.keyCode==13) document.getElementById(\'textfilter\').focus();" onchange="document.getElementById(\'textfilter\').value = this.options[this.selectedIndex].text;">';          document.myfilter.html_full_pre = '<select id="sel" size="5" onKeyDown="combo_onKeyDown(event);" onChange="document.getElementById(\'textfilter\').value = this.options[this.selectedIndex].text;">';
72          document.myfilter.html_full_post = '</select>';          document.myfilter.html_full_post = '</select>';
73  }  }
74    
75    function combo_filter(document,value) {
76    
77            if (! combo_active) {
78                    return;
79            }
80    
81            return document.myfilter.filter(document, value, headlines);
82    }
83    
84  function keypress(e) {  function keypress(e) {
85          var d = e.keyCode;          var d = e.keyCode;
86          if ((d == 37) || (d == 38) || (d == 39) || (d == 40)) {          if ((d == 37) || (d == 38) || (d == 39) || (d == 40)) {
87                  if (document.getElementById('sel'))     document.getElementById('sel').focus();                  if (document.getElementById('sel'))     document.getElementById('sel').focus();
88          }          }
89    
90            if (d != 13) combo_active = 1;
91  }  }
92    
93  </script>  </script>
# Line 81  function keypress(e) { Line 100  function keypress(e) {
100  <BODY onload="myfilter();">  <BODY onload="myfilter();">
101    
102  <div id="filterholder">  <div id="filterholder">
103  <div id="textfilterholder"><input autocomplete="off" id="textfilter" name="textfilter" type="text" onkeyup="document.myfilter.filter(document, this.value, headlines);" onKeyDown="keypress(event);" value=""></div>  <div id="textfilterholder">
104    <input autocomplete="off" id="textfilter" name="textfilter" type="text"
105     onKeyDown="keypress(event);"
106     onKeyUp="combo_filter(document, this.value);"
107    value=""></div>
108    
109  <div id="results">  <div id="results">
110  </div>  </div>
111    
 <div id="status">  
112  </div>  </div>
113    
114    <div id="status">
115  </div>  </div>
116    
117    <div style="color: #a0a0a0">
118  Text  If this combobox isn't working for you, try running <tt>make combo</tt> to create
119    example data from first 10000 words in <tt>/usr/share/dict/words</tt>.
120    </div>
121    
122  </BODY>  </BODY>
123  </HTML>  </HTML>

Legend:
Removed from v.11  
changed lines
  Added in v.24

  ViewVC Help
Powered by ViewVC 1.1.26