|
From: Leif W <war...@us...> - 2003-09-02 20:04:17
Attachments:
autocomplete.html
|
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 |
|
From: Raymond I. <xw...@ya...> - 2003-09-05 16:14:35
|
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 <war...@us...> 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
|
|
From: Leif W <war...@us...> - 2003-09-05 23:24:33
|
Does anyone on the list know about DOM Text Ranges in Opera (any version)?
I got Opera 7 running now (nice and fast, I was shocked). But I haven't
been able to find specific documentation or code examples (that work, not
just claim to work). Do my scripts work on Safari? I have no *Mac access.
If possible I'd like to work out all the major compatibility kinks while I'm
still in a stand-alone sandbox script, rather than find a hangup when I am
half-way through the DynAPI integration.
Leif
----- Original Message -----
From: "Raymond Irving" <xw...@ya...>
To: <dyn...@li...>
Sent: Friday, September 05, 2003 12:14 PM
Subject: Re: [Dynapi-Dev] JS/DOM Autocompletion in IE6 / Mozilla 1.4
>
> 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 <war...@us...> 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
> Dyn...@li...
> http://www.mail-archive.com/dyn...@li.../
>
>
|