Modify IMG tags within a table, based on existance of string in source of page

G

Got2Go

Hello,

I am trying to come up with a function that will search the source
of the page for a specific string.
If that string is found, then have it modify specific tags inside
of a table and display a link on the page.
This link, when clicked will then restore the modified tags
back to their original values.


Basically, this will allow a viewer of the page to enable or
disable images within a table based on the existence of a specific
string in the source of the page.

Any help is greatly appreciated.
 
R

Randy Webb

Got2Go said:
Hello,

I am trying to come up with a function that will search the source
of the page for a specific string.
If that string is found, then have it modify specific tags inside
of a table and display a link on the page.
This link, when clicked will then restore the modified tags
back to their original values.


Basically, this will allow a viewer of the page to enable or
disable images within a table based on the existence of a specific
string in the source of the page.

Any help is greatly appreciated.

Grab the innerHTML of the document, then search for the string. If its
present, then loop through the images collection and modify them. Of
course, you would have to either put the script in an external file or
parse out the <script> elements.
 
G

Got2Go

Hi Randy,
Thanks for your post.
Do you have some pseudo-code you could post?

Also, when the page loads, can the JavaScript modify the IMG tags before the
browser tries to download the images ?
Or would the browser start to get the images and then JS would disable the
tags ?

What I'm trying to do is have it so the page loads, and immediately, the JS
would disable the images before they are even requested from the server.
Then, allow the user to enable the images using a link placed on the page by
the same JS function.

You think this would/could work ?

Thanks again for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top