所以我试图创建一个简单的选择表单,就像你现在在大多数网站上看到的一样。当您点击其他选项时,我无法转到下一页。
<div class="pages" style="text-align:center; padding-top:10px; ">Navigation:
<select style="width:300px;">
<option value="/files/articles/1.html" selected="selected">1.Introduction</option>
<option value="/files/images/6.html">2. images</option>
<option value="/files/video/7.html">3. Video</option>
<option value="/files/news/8.html">4. News</option>
</select>
</div>
答案 0 :(得分:0)
<script type="text/javascript">
$(document).ready(function() {
$(".pages select").change(function() {
window.location = $(".pages select option:selected").val();
});
});
</script>
答案 1 :(得分:0)
您希望收听onchange事件,以便当select标记中的值发生更改时,您可以获取该值,然后导航到该网址,如下所示:
<强>的Javascript 强>
function onChangeNavigate(d) {
window.top.location = d.value;
}
<强> HTML 强>
<div class="pages" style="text-align:center; padding-top:10px; ">Navigation:
<select onchange="onChangeNavigate(this)" style="width:300px;">
<option value="/files/articles/1.html" selected="selected">1. Introduction</option>
<option value="/files/images/6.html">2. images</option>
<option value="/files/video/7.html">3. Video</option>
<option value="/files/news/8.html">4. News</option>
</select>
</div>
答案 2 :(得分:0)
<div class="pages" style="text-align:center; padding-top:10px; ">Navigation:
<select style="width:300px;" onchange="nextpage(this)">
<option value="/files/articles/1.html" selected="selected">1. Introduction</option>
<option value="/files/images/6.html">2. images</option>
<option value="/files/video/7.html">3. Video</option>
<option value="/files/news/8.html">4. News</option>
</select>
</div>
<script type="text/javascript">
function nextpage(select){
window.location = select.value;
}
</script>
答案 3 :(得分:0)
更改此内容:<select style="width:300px;">
致<select style="width:300px;" onchange="document.location = this.value">