问题
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
:
Create the
iframe
with a name.<iframe name="theFrame"></iframe>
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