【发布时间】:2021-10-17 11:08:38
【问题描述】:
由于我对 JavaScript 不是很熟悉,所以需要一点帮助。
我有一个简单的表单,其中包含 1 个标题行、1 个搜索按钮、1 个描述字段和提交按钮。
<form action="test_form.php" method="get" id="test_form1">
Überschrift: <input name="label" id="label" type="text" /> <input name="google" type="button" value="google" /><br />
Beschreibung: <textarea id="description" name="description" rows="5" cols="33">Beschreibung eingeben</textarea><br />
</form>
<button type="submit" form="test_form1" value="Submit">Eintragen</button>
如果我在标题行输入内容并单击 google 按钮,Google 页面应在新选项卡中打开,并且标题行中的文本应自动附加到链接作为搜索参数。
例如在标题行“动画图像”中,当您点击 Google 按钮时,应该会打开一个新标签页,其中包含 URL“https://www.google.com/search?q=animated+Images”。
如果它没有出现在标题中,当您点击 Google 时,Google 页面应该会在新标签页(“https://www.google.com”)中打开。
整个事情应该在不提交实际表单的情况下发生。
【问题讨论】:
标签: javascript php html jquery forms