Created
February 1, 2012 13:54
-
-
Save Error-331/1717029 to your computer and use it in GitHub Desktop.
Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>Autocomplete</title> | |
| <style> | |
| </style> | |
| <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> | |
| <script type="text/javascript"> | |
| var suggestions = new Array("America", "Armenia", "Dallas", "Canada", "Nikolaev"); | |
| function Copy() | |
| { | |
| alert('v'); | |
| } | |
| function FindAuto() | |
| { | |
| var tmpTextVal = document.getElementById('autoinput').value; | |
| var tmpDiv = document.getElementById('AutoText'); | |
| tmpDiv.innerHTML = ''; | |
| for (Counter1 = 0; Counter1 < suggestions.length; Counter1++) | |
| { | |
| if (tmpTextVal.toLowerCase() == suggestions[Counter1].substr(0, tmpTextVal.length).toLowerCase()) | |
| { | |
| tmpDiv.innerHTML += '<span>'+ suggestions[Counter1] + '</span>' + '<br/>'; | |
| } | |
| } | |
| $('#AutoText span').bind('click', function(event) { | |
| document.getElementById('autoinput').value = $(this).text(); | |
| }); | |
| } | |
| </script> | |
| </head> | |
| <body> | |
| <form name="AutoForm"> | |
| <input type="text" name="text" id="autoinput" onkeyup="javascript:FindAuto();"/> | |
| <div id="AutoText"> | |
| </div> | |
| </form> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment