Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何将下拉列表与URL一起使用_Html - Fatal编程技术网

Html 如何将下拉列表与URL一起使用

Html 如何将下拉列表与URL一起使用,html,Html,我想使用一个带有url的下拉列表,当用户选择一个元素时,它将像一个简单的链接一样打开,这是我做的,但它不起作用,我仍然在我的当前页面中 $(文档).ready(函数(){ $(“#header-link1”).change(函数(){ if($(this.val()!=“”){ window.location.href=$(this.val(); } }); 选择选项 国际休闲酒店15 雷格朗蒂安15 试试这个:- 使用JQuery实现此目的 $(文档).ready(函数(){ $(“#h

我想使用一个带有url的下拉列表,当用户选择一个元素时,它将像一个简单的链接一样打开,这是我做的,但它不起作用,我仍然在我的当前页面中


$(文档).ready(函数(){
$(“#header-link1”).change(函数(){
if($(this.val()!=“”){
window.location.href=$(this.val();
}
});
选择选项
国际休闲酒店15
雷格朗蒂安15
试试这个:-

使用
JQuery
实现此目的

$(文档).ready(函数(){
$(“#header-link1”).change(函数(){
if($(this.val()!=“”){
window.location.href=$(this.val();
}
});
});

选择选项
国际休闲酒店15
雷格朗蒂安15

试试这个!应该可以!只需选择选项值并重定向用户

<form >
    <select name="forma" onchange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);">
        <option value="http://surtymar.com/fr/reglementation-internationale/">Réglementation internationale 15</option>
        <option value="http://surtymar.com/fr/reglementation-union-europeenne/">Réglementation 15</option>
    </select>
</form>

国际休闲酒店15
雷格朗蒂安15

“它不起作用”没有告诉我们足够的信息来帮助您。请提供一个)你期望的结果,b)你得到的结果,c)任何错误消息。谢谢。没有错误,我单击了,什么也没有发生,我仍然在我的当前页面。你想在用户单击后重定向到另一个页面吗?我在代码中看不到任何用户可以单击的内容,或者任何处理该单击的内容,你需要将更多代码添加到你想要的内容中你已经发布了。我现在编辑你可以看到@Mandyshawshok's,但它不起作用,我编辑我的帖子是为了看看我做了什么。是的,你是对的,你能看到我的帖子在哪里有错误吗?@Stanleyel you's missing});看剧本,上帝保佑你,兄弟!我做到了,真的很抱歉,我是新来的!