Solved

change IFrame image size from parent

Posted on 2007-04-07
4
1,823 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
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The business world is becoming increasingly integrated with tech. It’s not just for a select few anymore — but what about if you have a small business? It may be easier than you think to integrate technology into your small business, and it’s likely…
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

809 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