[ Index ] |
PHP Cross Reference of Eventum |
[Summary view] [Print] [Text view]
1 // Author: Matt Kruse <matt@mattkruse.com> 2 // WWW: http://www.mattkruse.com/ 3 // 4 // Modified by João Prado Maia <jpm@mysql.com> 5 6 function autoComplete(field, options) 7 { 8 var found = false; 9 for (var i = 0; i < options.length; i++) { 10 if (options[i].toUpperCase().indexOf(field.value.toUpperCase()) == 0) { 11 found = true; 12 break; 13 } 14 } 15 if (field.createTextRange) { 16 var cursorKeys = "8;46;37;38;39;40;33;34;35;36;45;"; 17 if (cursorKeys.indexOf(event.keyCode+";") == -1) { 18 var r1 = field.createTextRange(); 19 var oldValue = r1.text; 20 var newValue = found ? options[i] : oldValue; 21 if (newValue != field.value) { 22 field.value = newValue; 23 var rNew = field.createTextRange(); 24 rNew.moveStart('character', oldValue.length) ; 25 rNew.select(); 26 } 27 } 28 } 29 } 30
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Dec 19 21:21:33 2007 | Cross-referenced by PHPXref 0.7 |