Pass a client side Javascript to an HTML Element Dynamically

I did a little test, and the approach I outlined above did work, so you probably need to debug a little to see what doesn’t work for you.

For your reference, the content of the “body” of the HTML I used is:

<body>
    <iframe id="theFrame" width="100%" height="100%" style="border:none;"/>
</body>

If you still don’t manage to get it working you can try posting a link to your site/editor so we could take a look.

Good luck