0

I have Iframe created dynamically on click, and the src file loaded by iframe contains huge dropdown list, I set iframe height dynamically using this method, now inside the iframe if the user click on dropdown the values are not shown completely

So, onclicking the dropdowns I will set the iframe height to show all dropdown values by calling a function

<a href="javascript(0)" id="dp1" onclick="setIframeHeight(this.id)">sources</a>

my javsctip looks like :

function setIframeHeight(no){
    var iFrameID = window.frameElement.id; // diplays exact id of iframe
        window.parent.document.getElementById(iFrameID).height  = '1500px';
}

/* as i get iframe id, how to set the height of the iframe. */
Charlie
  • 22,886
  • 11
  • 59
  • 90

1 Answers1

0

It should be

window.parent.document.getElementById(iFrameID).style.height  = '1500px';

However, if you are trying to set the iFrame height from within the guest content AND guest_origin !== host_origin, you will have to run a function of the host to make the frame adjustment work.

Charlie
  • 22,886
  • 11
  • 59
  • 90