Guest User

Untitled

a guest
Oct 17th, 2011
97
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.  
  3. <head>
  4.   <script type="text/javascript" src="jquery-1.6.2.js"></script>
  5.   <script type="text/javascript" src="jquery-ui-1.9m6.js"></script>
  6. </head>
  7.  
  8. <body>
  9.   <p>Autocomplete: <input type="text" id="autocomplete" /></p>
  10.   <p>Textbox: <input type="text" id="text" /></p>
  11.   <button id="logclear">Clear log</button>
  12.   <ul id="log"></ul>
  13.  
  14.   <script type="text/javascript">
  15.     // Simple event logging
  16.     var logEvent = function(e) {
  17.       $('#log').append('<li>' + e.type + ': ' + e.keyCode + '</li>');
  18.     }
  19.    
  20.     // Create an autocomplete
  21.     $('#autocomplete').autocomplete();
  22.    
  23.     // Log what's typed in the text field
  24.     $('#text').bind({
  25.       keydown: logEvent,
  26.       keypress: logEvent
  27.     });
  28.    
  29.     // Nice log display
  30.     $('#log').css({
  31.       height: '400px',
  32.       border: 'solid 1px #000',
  33.       overflow: 'scroll'
  34.     });
  35.    
  36.     // Clear log button handling
  37.     $('#logclear').button().click(function() {
  38.       $('#log').empty();
  39.     });
  40.   </script>
  41. </body>
  42.  
  43. </html>
  44.  
RAW Paste Data