从下拉表单加载选择页面 [英] Load page on selection from dropdown form

查看:101
本文介绍了从下拉表单加载选择页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个下拉菜单,让我可以访问各种网页。现在它已经设置完毕,所以你做出选择然后你点击一个Go按钮,然后它会把你带到适当的链接。我试图找出如何做到这一点,当你做出选择时,它会自动进行,你不需要按Go按钮。

I am trying to make a drop down menu that takes me to various webpages. Right now it is set up so you make your selection and then you hit a "Go" button and then it takes you to the appropriate link. I am trying to figure out how to make it so when you make your selection it automatically goes and you don't need to push the "Go" button.

这里是我有什么:

Here is what I have:

<p align="center">
<form name="jump" class="center">
<select name="menu">
<option value="#">Select an option</option>
<option value="/link1.shtml">Link 1</option>
<option value="/link2.shtml">Link 2</option>
<option value="/link3.shtml">Link 3</option>
</select>
<input type="button" onClick="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">
</form>
</p>

任何帮助或解释链接都会很好。谢谢!

Any help or links to explanations would be great. Thank you!

推荐答案

请尝试以下操作:

Try the following:

<select onchange="location = this.options[this.selectedIndex].value;">
    <option>Please select</option>
    <option value="http://www.apple.com/">Apple</option>
    <option value="http://www.bbc.com">BBC</option>
    <option value="http://www.facebook.com">Facebook</option>
</select>​

您正在寻找的是'onchange',而不是'onsumbit'

What you were looking for was 'onchange' instead of 'onsumbit'

这篇关于从下拉表单加载选择页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆