you are too right, also selecting one letter gives strange results.
The example is of course just an idea.
I see two solutions to this - either parse the existing text, embedding
hidden tags inside each duplicate word, and dis-allow single letter
selection, should work ok I think.
Or apply the <b> to the first occurrence of the word, and ask the user if
this is correct or not etc.
You can get several x/y coords about the selection in IE (not in NS) , but
they are in pixels relative to the document, and line height (or width of
selection or something).
I'll have a go at the first idea when I have a chance.
Richard
----- Original Message -----
From: "Michael Pemberton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 10, 2001 4:31 AM
Subject: Re: [Dynapi-Help] I need some advice/can ECMA/JAVA-script do this?
> I have a qeustion regarding the use of such a technique. how to you work
out
> WHICH occurance of the selected text is the one to work with. Won't the
example
> show just find the first occurance without knowing that it might actually
be the
> second / third / etc that was selected.
>
> eg: "the purpose of this is to test the code"
>
> if the user selects "the", the example you gave would simple alter the
first
> word and not the eighth.
> if the use selects "is", the last two letters in "this" will be
altered.
>
> Is there any method of locating the text more accurately?
>
> Paul K Egell-Johnsen wrote:
>
> > Richard Bennett wrote:
> > >
> > > If I understand, you want to select some text, and click a button to
add
> > > <b></b> around it?
> > > I have an example of that here:
> > >
http://www.richardinfo.f2s.com/dynapi/Richard_Examples/bold_italic_onTheFly.
> > > html
> > > you don't see the tags, because they are rendered, but in a text box
you
> > > would see them of course.
> > > This doesn't specifically need the DynAPI.
> >
> > Exactly what I was looking for. Thank you.
> >
> > --
> > Paul K Egell-Johnsen
> > Developer/PR Manager
> > eZ systems as
> > http://ez.no/
> >
> > _______________________________________________
> > Dynapi-Help mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
> --
> Michael Pemberton
> [EMAIL PROTECTED]
> ICQ: 12107010
>
>
>
>
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
>
_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help