帮助选择标签为html

AGe*_*eek 0 html

<select onchange ="----">
 <option value="a">a</option>
 <option value="b">b</option>
 <option value="c">c</option>
</select>
Run Code Online (Sandbox Code Playgroud)

我想写一小段代码wherien如果一个人选择任何项目,那么它应该移动到显示正在选择什么值的下一个html页面.

我怎样才能做到这一点..

希望我的怀疑是清楚的

这里的任何建议将不胜感激......

谢谢..

Guf*_*ffa 5

所有表单字段都有一个form属性,您可以使用该属性轻松访问form要提交的元素.

您还需要标记中的name属性select,否则它将无法使用.

<select name="item" onchange="this.form.submit();">
Run Code Online (Sandbox Code Playgroud)

或者,您可以通过设置窗口的位置转到另一个页面,在查询字符串中添加值:

<select onchange="window.location.href='NextPage.html?item='+this.options[this.selectedIndex].value;">
Run Code Online (Sandbox Code Playgroud)