此页面按照我希望的方式执行:http://www.web-source.net/javascript_redirect_box.htm
但我想找到一种使用 jQuery 的更好方法,谁能告诉我一个使用 jQuery 来完成此任务的好脚本?
最佳答案
您不需要为此预先打包的脚本,只需几行代码。
// get your select element and listen for a change event on it
$('#selectEl').change(function() {
// set the window's location property to the value of the option the user has selected
window.location = $(this).val();
});
关于javascript - 从选择下拉列表中选择项目时自动重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/580281/