【发布时间】:2013-07-28 18:32:40
【问题描述】:
我希望能够拥有它,以便用户可以在表单输入中输入他们想要的任何网站并单击提交并将该网站加载到 iframe 中。
我的代码是:
<body>
<form method="post" target="browser">
<input style="width:82%;" placeholder="Put the website here" name="url" type="text" />
<input style="width:8%;" name="submit" type="button" value="Go" />
</form>
<iframe name="browser" src="http://google.com" style="height:100%; width:100%"></iframe>
</body>
有点像迷你浏览器,网站还有更多内容,除了玩笑之外不会用于实际目的,所以我不担心不良做法。
最好不要使用javascript,但如果是也可以。
谢谢!
【问题讨论】:
-
我在有以前的答案时回答了,因为:Pietu1998 的答案在没有修复的情况下将无法工作,Karthikeyan 的答案并不完整,而 faino 的答案对于这种简单的行为来说太复杂了,尤其是因为听起来你不知道不想过多地使用 javascript。