Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37872
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Attach search tags to web images? |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <41787270-f2cc-4fc0-9ea3-d2d8918d7100@googlegroups.com> <XnsAB1374D1483D5eejj99@194.109.6.166> <eeeba635-57d6-43d1-ba36-5b4eb92213da@googlegroups.com> |
| Date | 2019-11-26 12:57 +0100 |
| Message-ID | <XnsAB1383CA222F8eejj99@194.109.6.166> (permalink) |
RG III <mob.rrr.3@gmail.com> wrote on 26 Nov 2019 in comp.lang.javascript:
>>
>> What is a "browser keyword search"?
>>
>> Do you mean "browser text search"?
>>
> Yes. Like when a user presses Ctrl+F to find text words on a webpage.
Since css '::before' does not seem to work in an img,
and such text cannot be searched for anyway,
and supposing all images being inline,
and wanting to seach for image title strings,
try:
for (anImg of document.querySelectorAll('img')) {
if (anImg.title != '') {
const span = document.createElement('span');
const br = document.createElement('br');
const title = document.createTextNode(anImg.title);
anImg.parentNode.replaceChild(span, anImg);
span.appendChild(title);
span.appendChild(br);
span.appendChild(anImg);
span.style.fontSize = '1px';
};
};
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Attach search tags to web images? RG III <mob.rrr.3@gmail.com> - 2019-11-26 00:00 -0800
Re: Attach search tags to web images? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-11-26 11:29 +0100
Re: Attach search tags to web images? RG III <mob.rrr.3@gmail.com> - 2019-11-26 02:58 -0800
Re: Attach search tags to web images? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-11-26 12:57 +0100
Re: Attach search tags to web images? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-11-26 13:06 +0100
Re: Attach search tags to web images? Julio Di Egidio <julio@diegidio.name> - 2019-11-26 04:17 -0800
Re: Attach search tags to web images? dr.j.r.stockton@gmail.com - 2019-11-26 04:23 -0800
Re: Attach search tags to web images? dr.j.r.stockton@gmail.com - 2019-11-26 04:37 -0800
Re: Attach search tags to web images? Martin Leese <please@see.Web.for.e-mail.INVALID> - 2019-11-27 13:29 -0700
Re: Attach search tags to web images? Arno Welzel <usenet@arnowelzel.de> - 2019-11-28 12:13 +0100
csiph-web