do you have it live somewhere? Can you post the HTML too?

On Tue, 2 Nov 2004 13:00:42 -0600, Deanna Schneider
<[EMAIL PROTECTED]> wrote:
> Okay, no one's biting on cf-talk. Anyone care to take a look at this
> javascript and tell me why it chokes on spaces. (It's a type-ahead
> script, and it fills in the text box, but as soon as you enter a
> space, it stops.)
> 
> function autoComplete (field, select, property, forcematch) {
>         var found = false;
>         for (var i = 0; i < select.options.length; i++) {
>         if 
> (select.options[i][property].toUpperCase().indexOf(field.value.toUpperCase())
> == 0) {
>                 found=true; break;
>                 }
>         }
>         if (found) { select.selectedIndex = i; }
>         else { select.selectedIndex = -1; }
>         if (field.createTextRange) {
>                 if (forcematch && !found) {
>                         field.value=field.value.substring(0,field.value.length-1);
>                         return;
>                         }
>                 var cursorKeys ="8;46;37;38;39;40;33;34;35;36;45;";
>                 if (cursorKeys.indexOf(event.keyCode+";") == -1) {
>                         var r1 = field.createTextRange();
>                         var oldValue = r1.text;
>                         var newValue = found ? select.options[i][property] : 
> oldValue;
>                         if (newValue != field.value) {
>                                 field.value = newValue;
>                                 var rNew = field.createTextRange();
>                                 rNew.moveStart('character', oldValue.length) ;
>                                 rNew.select();
>                                 }
>                         }
>                 }
>         }
> 
> //
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF 
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=36

Message: http://www.houseoffusion.com/lists.cfm/link=i:5:133704
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to