Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Arno Welzel Newsgroups: alt.computer,comp.lang.javascript,sci.electronics.design Subject: Re: How get windows FIND() to work? Date: Wed, 5 Aug 2020 07:55:25 +0200 Lines: 63 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net yCbRyxwzAl3DwqhqMOrmzQ9K0jLoaZ52UyAkr71V42ds/UUqut Cancel-Lock: sha1:TPbsopKxV7ZDRXHlxTgiSaRusO0= In-Reply-To: Xref: csiph.com alt.computer:11885 comp.lang.javascript:38658 sci.electronics.design:597238 Robert Baer: > Arno Welzel wrote: >> Robert Baer: >> >>> Environment: Win7.1 Firefox 78 >>> >>> Sample line used: >>> Downhole Measurements >>> >>> 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 ... 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 ... 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