Javascript iframe 中的 Open.window
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14104801/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Open.window in iframe
提问by Unknown
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.
我正在制作一个有趣的简单网页,我是 JavaScript 的菜鸟,我想在单击时打开窗口,我想在 iframe 中打开它们,我想为其提供普通 window.open 的所有功能我还希望它最大化窗口,但在 iframe 内部而不是外部。我知道关于 window.open 并开始工作我只是想让窗口在 iframe 内而不是在外面工作。我使用记事本作为我的编辑器。这是我的第一个问题,所以如果我犯了任何错误,请原谅我,谢谢。
回答by Praveen Kumar Purushothaman
If you want to open a windowwithin an iframe:
如果你想window在一个中打开一个iframe:
Create the
iframewith a name.<iframe name="theFrame"></iframe>Now use the
scriptthis way:window.open(url, "theFrame");
创建
iframe一个名称。<iframe name="theFrame"></iframe>现在使用
script这种方式:window.open(url, "theFrame");
回答by Zack
If you give your iFrame a name attribute, you can reference that name in the target attribute of your links.
如果您为 iFrame 提供名称属性,则可以在链接的目标属性中引用该名称。
<a href="http://www.microsoft.com" target="IFrame">Link Text</a>

