Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8149503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:51:56+00:00 2026-06-06T14:51:56+00:00

newer to javascript. On my page (asp.net application, vb as serverside language), I am

  • 0

newer to javascript. On my page (asp.net application, vb as serverside language), I am using document.getElementsByTagName(“img”) to get all img tagged html items. I am noticing one in particular does not show up in this list (I was able to put them into an array and access the items individually – code below). This item is is contained inside an iframe (the iframe doesn’t use SRC or anything else, just defined then the html inside it is right there in the source, doesnt load from another page – this is automatically generated by a crystal reports viewer generated at runtime, which is why I am unable to copy to show this). Is the getElementsByTagName not picking up this image because it is inside an iframe? I need to be able to access this img’s src (the image is another auto generated item from the crystal report viewer). If the reason why this is not picked up is due to the iframe, is there any way to either run this on items inside the iframe? Or just get the “innerhtml” type property for everything inside the iframe so that the img src can be accessed. Thank you for your help.

var IMGmatches = [];
        var IMGelems = document.getElementsByTagName("img");
        for (var j = 0; j < IMGelems.length; j++) {
            IMGmatches.push(IMGelems[j]);
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T14:51:58+00:00Added an answer on June 6, 2026 at 2:51 pm

    That’s because elements that are in iframes are not a part of the parent document.

    To get anything inside an iframe, you need to access the iframe’s contentDocument. So, your code might look like this:

    var IMGmatches = [], IMGelems = document.getElementsByTagName("img"),
        iframes = document.getElementsByTagName('iframe'), l = IMGelems.length,
        m = iframes.length, i, j;
    for( i=0; i<l; i++) IMGmatches[i] = IMGelems[i];
    for( j=0; j<m; j++) {
        IMGelems = iframes[j].contentDocument.getElementsByTagName("img");
        l = IMGelems.length;
        for( i=0; i<l; i++) IMGmatches.push(IMGelems[i]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my ASP.NET page I have <script src=Common2.js type=text/javascript ></script> How can I force
I'm trying to get setup using the DataAnnotations validator in ASP.Net MVC 2.0 Beta,
i have an ASP.net page that generates dynamic xml but the get statement of
I have the following in an ASP.NET 2.0 page. <script type=text/javascript> function pageLoad() {
I've got a web service (ASP.NET 2.0) that I'm calling from javascript using jQuery's
I wrote this on a simple ASP.NET page: jQuery(document).ready(function() { jQuery(form).submit(function() { alert(kikoo); return
Hello all gurus in the area of ASP.NET AJAX and JavaScript! Here's the deal:
I am writing an application (Asp.Net MVC) that contains a lot of reusable components.
okay, so i have an asp.net (C#) application and i want to add a
I have an HTML form that calls an ASP.NET page when a button is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.