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

Discussion in 'Javascript' started by Got2Go, Mar 5, 2005.

  1. Got2Go

    Got2Go Guest

    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
     
    Got2Go, Mar 5, 2005
    #1
    1. Advertising

  2. Got2Go

    Randy Webb Guest

    Re: Modify IMG tags within a table, based on existance of stringin source of page

    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
     
    Randy Webb, Mar 5, 2005
    #2
    1. Advertising

  3. Got2Go

    Got2Go Guest

    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" <> wrote in message
    news:...
    > 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
     
    Got2Go, Mar 5, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.austin.rr.com

    how to download img from html img tag

    news.austin.rr.com, Apr 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    512
    Steve C. Orr [MVP, MCSD]
    Apr 27, 2005
  2. Chris

    table-tags within div-tags

    Chris, Feb 9, 2004, in forum: HTML
    Replies:
    5
    Views:
    13,281
    Chris
    Feb 10, 2004
  3. Philipp Lenssen

    Problem: <img></img>

    Philipp Lenssen, Jun 27, 2005, in forum: XML
    Replies:
    15
    Views:
    766
    David Håsäther
    Jul 3, 2005
  4. Imre
    Replies:
    2
    Views:
    337
    mlimber
    May 25, 2006
  5. Jopek
    Replies:
    7
    Views:
    404
    dorayme
    Apr 26, 2009
Loading...

Share This Page