HTML表单目标重定向到外部wbsite

HTML表单目标重定向到外部wbsite,html,forms,target,Html,Forms,Target,只是好奇,是否可以针对一个外部网站 <html> <body> <form target="http://www.google.com"> <input type="submit" name="submit"/> </form> </body> </html> 当我单击submit时,似乎只是打开了一个新窗口,其中包含相同的页面。有什么想法吗?我希望它直接进入谷歌 您误解了target属性,并将其与acti

只是好奇,是否可以针对一个外部网站

<html>
<body>
<form target="http://www.google.com">
<input type="submit" name="submit"/>
</form>
</body>
</html>


当我单击submit时,似乎只是打开了一个新窗口,其中包含相同的页面。有什么想法吗?我希望它直接进入谷歌

您误解了
target
属性,并将其与
action
属性混淆

表单的
target
属性用于引用框架和iFrame,即将表单发布到哪个打开窗口

如果要将数据发布到google,请使用表单的
action
属性,该属性告诉表单在何处发布/获取数据:

<html>
<body>
<form action="http://www.google.com">
<input type="submit" name="submit"/>
</form>
</body>
</html>

我想你想要的是
行动
,一个人可以拥有一个URL<代码>目标告诉浏览器在哪个窗口中打开url