473,387 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
2 1693
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chris McKeever | last post by:
I am trying to modify the Mailman Python code to stop mapping MIME-types and use the extension of the attachment instead. I am pretty much clueless as to what I need to do here, but I think I have...
0
by: Fuzzyman | last post by:
I am trying to parse an HTML page an only modify URLs within tags - e.g. inside IMG, A, SCRIPT, FRAME tags etc... I have built one that works fine using the HTMLParser.HTMLParser and it works...
18
by: Shannon Jacobs | last post by:
Trying to solve this with a regex approach rather than the programmatic approach of counting up and down the levels. I have a fairly complicated HTML page that I want to simplify. I've been able to...
3
by: Viken Karaguesian | last post by:
Hello all, Me again :>) Can I modify certain attributes in a style within a stylesheet? Example: I have a style sheet that looks like this: body { background-color: black; font-family: Arial;...
11
by: Konrad Den Ende | last post by:
I have a function returning a string but the problem is that the color of it is blue which suits me well for some pages but not for others. Is it possible to "feel" what the color of the background...
6
by: t.nicolson | last post by:
Hi there. I'm basically trying to expand a form within a table dynamically. To this end i've declared a placeholder within my table which i want to fill out using a javascript. eg. <div...
4
by: John | last post by:
I am using code provided by Mr. Steele that allows for my MDB to dynamically connect to remote SQL server databases. The code works fine as follows: Type TableDetails TableName As String...
5
by: Martman | last post by:
First here is my goal: When a datalist is rendered to a page and you use the <itemtemplate> the datalist automatically prints a <tr> <td> start and end tags. Now this may not be too bad but I...
2
by: Andrew Robinson | last post by:
I would like to use a ContentPlaceHolder within the following. Any ideas on how to best accomplish this? <td rowspan="2" style="width: 600px; background-image: url('<asp:ContentPlaceHolder...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.