By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,978 Members | 1,467 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,978 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.

--
Got2Go
Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Got2Go wrote:
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #2

P: n/a
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.

"Randy Webb" <Hi************@aol.com> wrote in message
news:Rv********************@comcast.com...
Got2Go wrote:
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.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.