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


Groups > comp.lang.javascript > #19381

Based on its src value, find an image and assign an ID?

From Tuxedo <tuxedo@mailinator.com>
Newsgroups comp.lang.javascript
Subject Based on its src value, find an image and assign an ID?
Date 2013-04-20 23:21 +0200
Organization albasani.net
Message-ID <kkv0sq$8mp$1@news.albasani.net> (permalink)

Show all headers | View raw


Using a same header image, e.g. <img src=placeholder.gif> that is generated 
and cannot be changed after it's been initially loaded into a page view, 
can an ID be assigned later in the document flow?

Initially there is no ID at all. The numeric image index may differ from 
page to page.

The only part the image can be identified by is its initial src value, 
which is always the same on all pages. The image appears only once on any 
inidividial page.

Can the image be identified and have an ID assigned?  If so, perhaps a way 
is to by the body onload function find all images in the loaded document 
and compare their src values with the known one, then assign an ID, eg. 
<img ... id=pagexyz. Thereafter, something can be done, such as a simple 
replace for example, getElementById("pagexyz").src=header2.jpg.

Is this possible? If so, what is the most direct way?

Many thanks,
Tuxedo

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


Thread

Based on its src value, find an image and assign an ID? Tuxedo <tuxedo@mailinator.com> - 2013-04-20 23:21 +0200
  Re: Based on its src value, find an image and assign an ID? Stefan Weiss <krewecherl@gmail.com> - 2013-04-20 23:42 +0200
    Re: Based on its src value, find an image and assign an ID? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-21 00:22 +0200
      Re: Based on its src value, find an image and assign an ID? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-21 00:36 +0200
      Re: Based on its src value, find an image and assign an ID? Stefan Weiss <krewecherl@gmail.com> - 2013-04-21 00:52 +0200
      Re: Based on its src value, find an image and assign an ID? Scott Sauyet <scott.sauyet@gmail.com> - 2013-04-20 17:20 -0700
        Re: Based on its src value, find an image and assign an ID? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-04-21 11:09 +0200
          Re: Based on its src value, find an image and assign an ID? Scott Sauyet <scott.sauyet@gmail.com> - 2013-04-23 06:32 -0700
  Re: Based on its src value, find an image and assign an ID? x@x.com (znôrt) - 2013-04-21 00:56 +0200
    Re: Based on its src value, find an image and assign an ID? x@x.com (znôrt) - 2013-04-21 00:59 +0200

csiph-web