Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting image from a link

Status
Not open for further replies.

Rayz66

Programmer
Sep 3, 2002
30
GB
Hi there .. :)

I have a link, which looks something like this:

Code:
<a href=&quot;page.jsp&quot;><img src=&quot;test.jpg&quot;></a>

Is it possible to get hold of the img src value directly. I can do it by parsing the contents of the link <a href>, but I wondered if there was a neater way of doing it ...

Thanks in advance ...
 
in javascript:
<img name=&quot;asd&quot; src=&quot;asd.jpg&quot; onclick=&quot;alert(this.src)&quot;>

Known is handfull, Unknown is worldfull
 
Good one, but I'm not generating the original HTML code, so I'm stuck with the

Code:
<a href=&quot;page.jsp&quot;><img src=&quot;test.jpg&quot;></a>


format ... :-(

 
there is a collection object in javascript (i dont know how to use it), it will give u all the images on a page...

Known is handfull, Unknown is worldfull
 
Mmmm ... does seem a little trickier than I first thought.

I'm actually dealing with a fragment of HTML, rather than a complete structure, so I reckon some kind of parsing is my best bet.

But thank you very much for taking the time to help me out ...

:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top