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. Advertisements

  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. Advertisements

  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. Advertisements

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. Ranganath

    Custom Tags within Custom Tags.

    Ranganath, Oct 17, 2003, in forum: Java
    Replies:
    2
    Views:
    651
    Ranganath
    Oct 21, 2003
  2. Kwasi
    Replies:
    13
    Views:
    815
    Kwasi Yeboah via JavaKB.com
    Dec 1, 2004
  3. Chris

    table-tags within div-tags

    Chris, Feb 9, 2004, in forum: HTML
    Replies:
    5
    Views:
    13,553
    Chris
    Feb 10, 2004
  4. Donald Firesmith

    html tags within meta tags allowed?

    Donald Firesmith, Jan 5, 2005, in forum: XML
    Replies:
    5
    Views:
    1,235
    Andy Dingley
    Jan 8, 2005
  5. Imre
    Replies:
    2
    Views:
    393
    mlimber
    May 25, 2006
  6. pkellner
    Replies:
    6
    Views:
    245
    William James
    Jul 30, 2005
  7. Replies:
    7
    Views:
    245
    Peter Makholm
    Sep 11, 2007
  8. trallon
    Replies:
    3
    Views:
    200
    Davey Erwin
    Sep 29, 2006
Loading...