Wonderful! This is great! >From the looks of things I think it should go within the GUI section as it will mainly be used by gui components. Otherwise it should go into the util section.
You can create and AutoComplete Class library so a user could create an autocomplete object: var ac = new AutoComplete(); // autocomplete could inherit the EventObject -- Raymond Irving --- Leif W <[EMAIL PROTECTED]> wrote: > I've recently put together an autocompletion script > that will work with an > input text field, with data either in a JS array, or > in a SELECT. It works > the same in IE6 and Mozilla 1.4. I couldn't find > the specific documentation > for the Mozilla functions used. I had to search the > CVS source tree, as the > "range" related objects (selecting a range of text) > and methods particular > to DOM aren't really very well documented. There's > some documentation of > Range for Mozilla, but I'm not using any of those > functions. I just > happened to find some bits of IE and Mozilla > specific autocompletion on the > web, and took and merged them. > > Would something like this be a useful utility for > the DynAPI? If so, where > should it go? If the code needs modifying for > DynAPI integration, I might > need some pointers. If the example doesn't work in > a browser (Opera, etc.) > I'd need someone else to fix it as I don't have > access to other browsers > yet. > > Leif > --------------------------------- Cross-browser autocompletionvar myAcData =[ "aardvark", "antipathy", "baseball", "basketball", "train", "train station"];/* * NAME: autoComplete * INPUT: * inputField: text field where user is typing * inputEvent: holds keystroke event data * acData: data to search for auto complete * acDataType: JavaScript array or HTML FORM's SELECT's OPTIONs. * OUTPUT: */function autoComplete ( inputField, inputEvent, acData, acDataType ){ var acDataTmp = new Array(); if ( acDataType == 'js' ) { for ( var i = 0; i Cross-browser autocompletion autocomplete a text field with data in array autocomplete a text field with data in a select field Supported Browsers: Internet Explorer 6 Mozilla 1.4 [input] aardvark antipathy baseball basketball train train station [input] aardvark antipathy baseball basketball train train station [input] aardvark antipathy baseball basketball train train station textField.createTextRange() textRange.moveStart( 'character', pos ) textRange.moveEnd( 'character', pos ) textRange.select() [Mozilla] textField.selectionStart() textField.setSelectionRange( start, stop ) textField.getCaretOffset( pos? ) textField.setCaretOffset( pos? ) --> __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dynapi-Dev mailing list [EMAIL PROTECTED] http://www.mail-archive.com/[EMAIL PROTECTED]/