Jump to content

image & url !?


Soledad
 Share

Recommended Posts

hello everybody at first I didn't know where I can add this post for example the logo of google.com has url : http://www.google.com/intl/en_ALL/images/srpr/logo1w.pngand in the page source the image includes in Id=hplogonow my request is : is there anyway to detect the image's url using the page url ???for example (I know this wrong but for idea :) ) :

http://www.google.com/#id=hplogo

because I don't know the urls of the images I wanna get ( their urls are changing) but I know their Id and I don't wanna using php and file_get_contents($url)please help me if possible thanks :)

Link to comment
Share on other sites

I entered google then in the url address set :

java script:document.getElementById('hplogo').src;

and it worked fine but I was searching for something like this :

http://www.google.com/java script:document.getElementById('hplogo').src

I know it won't work but the problem only this method I can use in my code :)note : the space between java and script is caused after I set the code here

Link to comment
Share on other sites

if your after the host and path prefixed to the image url, you shouldn't need to attach it manually as the .src property should return the full url to the image.if your wanting to go straight to the image URL:

location.assign(document.getElementById('hplogo').src);

also i just realized google's logo is in a html div element, not a img element. but i take it that's not a problem with the code your testing with, as you said it works.

Link to comment
Share on other sites

thanks my friends you are so amazing :)@JamesB the script is cooooooool but maybe I didn't explain my request clearly all I wanna is to get the url of the image without entering google.com all the codes you provide me I have to enter google then apply the script but my work is to insert the image in a specific page and this can't be done if I have to enter google I hope that can by applied coz i need it so much :)thanks for everything ...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...