如何将具有 2 个选择的 HTML 表单更改为 Javascript?
我正在使用以下 HTML 表单:
<form method = 'POST' action = '/python/stats/'>
<select name = 'team'>
<option value = 'team1'> team1 </option>
<option value = 'team2'> team2 </option>
<option value = 'team3'> team3 </option>
</select>
<select name = 'player'>
<option value = 'player1'> player1 </option>
<option value = 'player2'> player2 </option>
<option value = 'player3'> player3 </option>
</select>
<input type = 'submit' value = "Update">
</form>
操作 /python/stats 需要 2 个参数。我如何编辑这个表单(到javascript?)以便每次更改其中一个选择时都会调用该操作?
I am working with the following HTML form:
<form method = 'POST' action = '/python/stats/'>
<select name = 'team'>
<option value = 'team1'> team1 </option>
<option value = 'team2'> team2 </option>
<option value = 'team3'> team3 </option>
</select>
<select name = 'player'>
<option value = 'player1'> player1 </option>
<option value = 'player2'> player2 </option>
<option value = 'player3'> player3 </option>
</select>
<input type = 'submit' value = "Update">
</form>
The action /python/stats requires 2 parameters. How can I edit this form (to javascript?) so that the action is called each time either of the selects is changed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
表单标记中的
action
属性指定将表单提交
到的位置。要使用onchange
事件执行此操作,您可以在该事件中执行表单提交。the
action
property in the form tag specifies the location tosubmit
the form to. To do this with anonchange
event is, you can do a form submit in the event.