Solved

change IFrame image size from parent

Posted on 2007-04-07
4
1,826 Views
Last Modified: 2012-05-05
IE 7

I have an IFrame with an image in it. From the parent of the IFrame I need to change the width and height of the image. Here is the image:

<img id='picid' name='picname'  src='whatever.jpg">

what is the jscript in the parent to change the pic size?
thanks
0
Comment
Question by:steve44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 58

Accepted Solution

by:
amit_g earned 100 total points
ID: 18870636
If you have only one iframe, you can use

window.frames[0].getElementById("picid").src = "whateverNew.jpg";

If you have more than one iframe and/or frames, you need to use name of the iframe

window.frames["IFrameName"].getElementById("picid").src = "whateverNew.jpg";
0
 

Author Comment

by:steve44
ID: 18870797
I want to change the size so I tried:

window.frames["IFrameName"].getElementById("picid").style.width=100;

gives error:  object does not support this property or method
0
 

Author Comment

by:steve44
ID: 18870935
I should add that the main page is an HTA file but in the iframe tag i have application='yes'.
0
 

Author Comment

by:steve44
ID: 18872642
i had a syntax error. your solution worked.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Justin
In light of the WannaCry ransomware attack that affected millions of Windows machines, you might wonder if your Mac needs protecting. Yes, it does and here is how to do it.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question