Sha256: dbfd996038c09df82a26b1c2bcaab675fba80cea387e14015ea714b3e686ca8a
Contents?: true
Size: 1.52 KB
Versions: 3
Compression:
Stored size: 1.52 KB
Contents
<html> <head> <title>Server Side Autocompletion</title> <script type="text/javascript" src="js/ajax.js">#{}</script> <script type="text/javascript"> function hit() { ajax_get('hit?val=' + document.getElementById('hitval').value); return false; } function getWord(input, evt) { if (input.value.length == 0) { return; } //allow backspace to work in IE if (typeof input.selectionStart == 'undefined' && evt.keyCode == 8) { input.value = input.value.substr(0,input.value.length-1); } // Ignore the following keystrokes switch (evt.keyCode) { case 37: //left arrow case 39: //right arrow case 33: //page up case 34: //page down case 36: //home case 35: //end case 13: //enter case 9: //tab case 27: //esc case 16: //shift case 17: //ctrl case 18: //alt case 20: //caps lock case 8: //backspace case 46: //delete case 38: //up arrow case 40: //down arrow return; break; } lastLength = input.value.length; word = ajax_get('get_word?word=' + input.value) if (word.length > 1) { input.value = word try { input.setSelectionRange(lastLength, input.value.length); } catch(e) { } } } </script> </head> <body> <h1>Server side autocompletion</h1> <form> Enter a Country: <input type="text" id="country" name="country" value="" onkeyup="getWord(this,event)" autocomplete="off" /> </form> <h1>Send data to a server action</h1> <p> <input id="hitval" type="text" value="Test" /> <a href="#" onclick="hit()">Send</a> </p> </body> </html>
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nitro-0.13.0 | examples/ajax/public/index.xhtml |
nitro-0.15.0 | examples/ajax/public/index.xhtml |
nitro-0.14.0 | examples/ajax/public/index.xhtml |