Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #38658

Re: How get windows FIND() to work?

From Arno Welzel <usenet@arnowelzel.de>
Newsgroups alt.computer, comp.lang.javascript, sci.electronics.design
Subject Re: How get windows FIND() to work?
Date 2020-08-05 07:55 +0200
Message-ID <houvueFtpm8U1@mid.individual.net> (permalink)
References <kv3WG.33452$RN.31186@fx13.iad> <hos0lkFaglnU1@mid.individual.net> <CmpWG.247013$0W4.225640@fx42.iad>

Cross-posted to 3 groups.

Show all headers | View raw


Robert Baer:

> Arno Welzel wrote:
>> Robert Baer:
>>
>>>     Environment: Win7.1 Firefox 78
>>>
>>>      Sample line used:
>>> <a href="downhole-measurements.html?find=able">Downhole Measurements</a>
>>>
>>>      At least execution transfers from the calling HTML to the desired
>>> destination HTML.
>>>
>>>      BUT. the keyword does NOT get underlined or highlighted in any way.
>>
>> If course not. Why should adding "?find=able" do that?
>>
>> Technically calling "downhole-measurements.html?find=able" will just
>> open the document referred by "downhole-measurements.html" and pass the
>> querystring "find=able" to the server.
>>
>> If the document was opened locally as file and not via HTTP then adding
>> "?find=able" does nothing at all.
>>
>>>      It would be particularly nice if all the keywords got highlighted
>>> and the first keyword was presented on the screen (think loong document
>>> and keyword was in middle).
>>
>> Then you need to build some server side script which reads the document
>> and *adds* elements to highlight the places where the searched text was
>> found. For example if you use PHP on the server the URL could be:
>>
>> find.php?document=downhole-measurements.html&text=able
>>
>> Then the script "find.php" will get the paramters "document" and "text",
>> where "document" tells it which file to read and "text" which text to
>> search for.
>>
>    Sounds like that approach requires me to edit a few thousand FINDs at 
> minimum.
>    What added fuss is required for the document?
> 
>    Also, what does this find.php script look like?

It will open the file, read the content, does a strpos() on the search
term and add <span class="found">...</span> around the found word. You
may also need to add the "found" CSS rule like this:

.found {
  background-color: #ff0;
}

If you want to keep the URL "downhole-measurements.html?find=able" you
can also do this with a script in the document itself which takes the
URL (window.location.href), extracts the "find" parameter and calls
either window.find() or walks the DOM tree to add a <span
class="found">...</span> around the search hits - but in any case you
need *code* to do the finding. There is no solution which just works by
adding something to the URL.

-- 
Arno Welzel
https://arnowelzel.de

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How get windows FIND() to work? Robert Baer <robertbaer@localnet.com> - 2020-08-03 19:13 -0700
  Re: How get windows FIND() to work? Arno Welzel <usenet@arnowelzel.de> - 2020-08-04 04:49 +0200
    Re: How get windows FIND() to work? Julio Di Egidio <julio@diegidio.name> - 2020-08-04 02:11 -0700
      Re: How get windows FIND() to work? Arno Welzel <usenet@arnowelzel.de> - 2020-08-04 12:02 +0200
    Re: How get windows FIND() to work? Robert Baer <robertbaer@localnet.com> - 2020-08-04 20:06 -0700
      Re: How get windows FIND() to work? Arno Welzel <usenet@arnowelzel.de> - 2020-08-05 07:55 +0200
  Re: How get windows FIND() to work? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-08-03 19:55 -0700
    Re: How get windows FIND() to work? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-08-05 08:35 +0200
      Re: How get windows FIND() to work? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-08-05 11:19 -0700
        Highlighting text (was: How get windows FIND() to work?) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-08-06 02:15 +0200
  Re: How get windows FIND() to work? Clifford Heath <no.spam@please.net> - 2020-08-04 15:22 +1000
    Re: How get windows FIND() to work? Robert Baer <robertbaer@localnet.com> - 2020-08-04 10:06 -0700
      Re: How get windows FIND() to work? Arno Welzel <usenet@arnowelzel.de> - 2020-08-04 19:42 +0200
    Re: How get windows FIND() to work? Robert Baer <robertbaer@localnet.com> - 2020-08-04 20:13 -0700
      Re: How get windows FIND() to work? Clifford Heath <no.spam@please.net> - 2020-08-05 19:56 +1000
        Re: How get windows FIND() to work? Arno Welzel <usenet@arnowelzel.de> - 2020-08-05 13:54 +0200
          Re: How get windows FIND() to work? Clifford Heath <no.spam@please.net> - 2020-08-05 21:55 +1000
            Re: How get windows FIND() to work? Arno Welzel <usenet@arnowelzel.de> - 2020-08-05 15:40 +0200
              Re: How get windows FIND() to work? Robert Baer <robertbaer@localnet.com> - 2020-08-06 12:27 -0700
                Re: How get windows FIND() to work? Arno Welzel <usenet@arnowelzel.de> - 2020-08-07 14:09 +0200
            Re: How get windows FIND() to work? Robert Baer <robertbaer@localnet.com> - 2020-08-06 12:24 -0700
          Re: How get windows FIND() to work? Robert Baer <robertbaer@localnet.com> - 2020-08-06 12:23 -0700
        Re: How get windows FIND() to work? Robert Baer <robertbaer@localnet.com> - 2020-08-06 12:16 -0700
  Re: How get windows FIND() to work? "R.Wieser" <address@not.available> - 2020-08-04 09:10 +0200
    Re: How get windows FIND() to work? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-08-04 23:46 +0200
      Re: How get windows FIND() to work? Robert Baer <robertbaer@localnet.com> - 2020-08-04 20:21 -0700
        Re: How get windows FIND() to work? Arno Welzel <usenet@arnowelzel.de> - 2020-08-05 07:56 +0200
          Re: How get windows FIND() to work? Robert Baer <robertbaer@localnet.com> - 2020-08-06 11:40 -0700
            Re: How get windows FIND() to work? Arno Welzel <usenet@arnowelzel.de> - 2020-08-07 14:26 +0200
      Re: How get windows FIND() to work? "R.Wieser" <address@not.available> - 2020-08-05 08:59 +0200
        Re: How get windows FIND() to work? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-08-06 01:11 +0200
      Re: How get windows FIND() to work? Clifford Heath <no.spam@please.net> - 2020-08-06 11:36 +1000
        Re: How get windows FIND() to work? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-08-06 12:24 +0200
          Re: How get windows FIND() to work? Robert Baer <robertbaer@localnet.com> - 2020-08-06 12:40 -0700
            Re: How get windows FIND() to work? "R.Wieser" <address@not.available> - 2020-08-07 10:27 +0200
            Re: How get windows FIND() to work? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-08-08 04:39 +0200
          Re: How get windows FIND() to work? Clifford Heath <no.spam@please.net> - 2020-08-07 18:46 +1000
  Highlighting text (was: How get windows FIND() to work?) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-08-05 08:32 +0200
    Re: Highlighting text (was: How get windows FIND() to work?) "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-08-05 21:59 -0700
      Re: Highlighting text (was: How get windows FIND() to work?) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-08-08 04:22 +0200
    Re: Highlighting text Robert Baer <robertbaer@localnet.com> - 2020-08-06 12:06 -0700
  Re: How get windows FIND() to work? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-08-06 12:40 -0700

csiph-web