![]() |
how to extract img src from an external list
Greetings
I need your help please.. I have a website of 20 pages. Each page displays an image from a catalog located in another domain, and the catalog changes each week, so I have to change the img src attribute each week too (the jpg images are named differently each week, though in the same directory). So instead of editing 20 html pages each time, I'm trying to find a way to control the img src from a text file, so that I edit only that text file once a week. Is there a way to extract img src attributes from a text file or js file please? For example I need page 1 to extract the first img src listed in the text file, and page 2 to extract the second src listed, etc. I'm new to js so please give an example of the code that I should use. Many thanks. |
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"Code:
http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg |
Thanks very much.
I've tried your code (created test.html and ajaximg.txt in my pc desktop), but the test page didn't display any images. Do the files need to be uploaded to a server for them to work? |
both files need to be in the same directory
or the file path of ajaximg.txt needs to be specified in the call in any event both files must be in the same domain |
Yes, both files are on my desktop. But the test.html page loads nothing. I'm confused.. what is wrong?..
I tried the images and each loads fine on their own browser tabs. But still the page loads no images... |
| All times are GMT +1. The time now is 05:20 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.