Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

not able to get width and height of another html file inside html

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am not able to access iframe id in javascript function. This iframe present inside a div tag. It is giving error in the red part highlighted in my code below.
Please post your ideas on this.



CODE -->
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When posting please use code tags so it is readable. I did it for you, you need to do it in the future.

You have an id, so use document.getElementById to reference it, you do not need to use the frames array which uses a name, not an id.

Eric
 
Priya Sri
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

the problem is i need to get height and width of a html file inside current html file I changed the code like this. Its giving me the height and width of the current html page. But i need the details of html file present in iframe tag which is inside a div tag.

If i use document.frames instead of document.getElementbyId , it gives me the correct height and width of the html file inside iframe.
That also works if iframe is outside not inside div.


 
knowledge is the difference between drudgery and strategic action -- tiny ad
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic