Open.window in iframe

删除回忆录丶 提交于 2019-12-23 07:30:47

问题


I am making a simple webpage for fun and I am a noob at JavaScript and I want to make windows open up when clicked and I want to open them up inside an iframe and I want to give it all the functionality of a normal window.open and I also want it to maximize the windows but inside the iframe and not outside. I know About the window.open and go it to work I just want to make the windows work inside an iframe and not outside. I am using Notepad for as my editor. This is my first question so please forgive me if I made any mistakes thanks.


回答1:


If you want to open a window within an iframe:

  1. Create the iframe with a name.

    <iframe name="theFrame"></iframe>
    
  2. Now use the script this way:

    window.open(url, "theFrame");
    



回答2:


If you give your iFrame a name attribute, you can reference that name in the target attribute of your links.

<a href="http://www.microsoft.com" target="IFrame">Link Text</a>


来源:https://stackoverflow.com/questions/14104801/open-window-in-iframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!