Advertisement
Guest User

Untitled

a guest
Sep 11th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.09 KB | None | 0 0
  1.  
  2. <!DOCTYPE html><html lang="en"><head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><script src="http://1.2.3.4/bmi-int-js/bmi.js" language="javascript"></script><title>demo</title> <meta name="description" content="" /><meta name="generator" content="Studio 3 http://aptana.com/" /><meta name="author" content="amir" /><meta name="viewport" content="width=device-width; initial-scale=1.0" /><link rel="shortcut icon" href="/favicon.ico" /><link rel="apple-touch-icon" href="/apple-touch-icon.png" /><style type="text/css" style="display:none">ul.auto-list{display:none;position:absolute;top:0px;left:0px;border:1px solid green;background-color:#A3DF99;padding:0;margin:0;list-style:none;}ul.auto-list>li:hover,ul.auto-list>li[data-selected=true]{background-color:#236574;}ul.auto-list>li{border:1px solid gray;cursor:default;padding:2px;}mark{font-weight:bold;}
  3. </style>
  4. <style type="text/css">#ta{width:300px;height :100px;font-size:11px;font-family:"Helvetica Neue",Arial,sans-serif;white-space:pre;}</style> <script src="../lib/jquery/jquery-1.5.js" type="text/javascript"></script> <script src="auto.js" type="text/javascript"></script> <script type="text/javascript">var urls = [
  5. "facebook.com",
  6. "google.com",
  7. "twitter.com",
  8. "amirharel.com",
  9. "amazon.com",
  10. "microsoft.com",
  11. "quora.com",
  12. "walla.co.il",
  13. "ebay.com",
  14. "gowala.com",
  15. "myspace.com",
  16. "youtube.com"
  17. ];
  18.  
  19. function initURLTextarea(){
  20. $("#outter textarea").autocomplete({
  21. wordCount:1,
  22. mode: "outter",
  23. on: {
  24. query: function(text,cb){
  25. var words = [];
  26. for( var i=0; i<urls.length; i++ ){
  27. if( urls[i].toLowerCase().indexOf(text.toLowerCase()) == 0 ) words.push(urls[i]);
  28.  
  29. }
  30. cb(words);
  31. }
  32. }
  33. });
  34. }
  35.  
  36.  
  37. var countries = [];
  38. function initContriesTextarea(){
  39. $.ajax("countries.txt",{
  40. success: function(data, textStatus, jqXHR){
  41. countries = data.replace(/\r/g, "" ).split("\n");
  42.  
  43. $("#contries textarea").autocomplete({
  44. wordCount:1,
  45. on: {
  46. query: function(text,cb){
  47. var words = [];
  48. for( var i=0; i<countries.length; i++ ){
  49. if( countries[i].toLowerCase().indexOf(text.toLowerCase()) == 0 ) words.push(countries[i]);
  50. if( words.length > 5 ) break;
  51. }
  52. cb(words);
  53. }
  54. }
  55. });
  56.  
  57.  
  58. }
  59. });
  60.  
  61. }
  62.  
  63.  
  64. $(document).ready(function(){
  65. initContriesTextarea();
  66. initURLTextarea();
  67.  
  68. });
  69.  
  70.  
  71.  
  72. </script> </head><body><div><div id="contries">In this example the auto complete will try to find a match of country names<br/> <textarea style="width: 400px; height 250px;"></textarea></div><div id="outter">In this example i set the mode to be "outter" which is the default mode in IE<br/> I plan to fix this but will take some time...<br/> Just start type major sites urls and it will autocomplete(like facebook.com)<br/> <textarea style="width: 200px; height 250px;"></textarea></div></div></body></html><script language="javascript"><!--
  73. bmi_SafeAddOnload(bmi_load,"bmi_orig_img",1);//-->
  74.  
  75. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement