change IFrame image size from parent

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?
Who is Participating?
amit_gConnect With a Mentor Commented:
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";
steve44Author Commented:
I want to change the size so I tried:


gives error:  object does not support this property or method
steve44Author Commented:
I should add that the main page is an HTA file but in the iframe tag i have application='yes'.
steve44Author Commented:
i had a syntax error. your solution worked.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.