0

I have an iframe.

<iframe height="600px" id="theIframe" name="theIframe" src="" width="100%"></iframe>
 <a href="somelink" target="theIframe" 
    style="white-space:normal;color: #00f; text-decoration: underline"  >File: Name</a>

link is clicked it opens in the iframe of the visualforce page. I would like to know if it is possible to show the iframe only when the link is clicked. i.e When the page is loaded no iframe windows would be seen. Once the link is clicked the page would display the iframe and within the iframe another page would open

0

you can make use of Javascript to toggle display of iFrame using onClick event on the link like shown below:

<iframe height="600px" id="theIframe" name="theIframe" src="" width="100%" style="display:'none'"></iframe>
<a href="somelink" target="theIframe"
onclick="document.getElementById('theIframe').style.display== 'block' ?
document.getElementById('theIframe').style.display= 'none'
document.getElementById('theIframe').style.display= 'block'; 
return false;">
File: Name  </a>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.