On Dec 16, 3:31 pm, anmldr <[email protected]> wrote:
> >1. How to deal with multiple matches
>
> This is a list of drug names in an <ol> and each drug name is a <li>.
> The list is alphabetized.
>
> So, the first match is the only important one in this project.
>
> >2. Should whole words be matched, any string, or is there a choice?
>
> Partial words would be fine.
>
> >3. How to deal with strings split over multiple elements
>
> For this project, it would not be an issue. Only the innerHTML of the
> links would need to be searched. I cannot think of any instance where
> there would be other tags such as <em></em>
>
> >4. How will inserting extra elements in the markup affect the document?
>
> As long as the <a href> tag is not altered, it would not be a problem.
>
> An example page of what I will be using ishttp://www.anmldr.com/odesk/_A.html
Give each A element a unique name (say link0, link1, link2, etc. the
actual value is irrelevant). Get a reference to the parent OL, then
use getElementsByTagName('a') and loop over them looking at the
innerText/textContent property to see if you get a match. If you do,
use the name to adjust the location and apply a style to that A by
adding a particular value to the className property value.
When some other action occurs (navigate to selected page, do another
search, cancel search, whatever) remove the added className value.
There are other HTML5 based solutions (e.g. data- attributes + qSA)
but I'm not sure that's a good idea.
--
Rob
--
You received this message because you are subscribed to the Google Groups
"iPhoneWebDev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/iphonewebdev?hl=en.