这是一个 jQuery 选项。
http://jsfiddle.net/4EjGt/6/
JS
//Global var to track our selected tabs
var m_selectedTabs = $('#tab1');
m_selectedTabs.siblings('span').hide();
$('#Week').change(function(){
SelectTabRangeById($(this).find(':selected').val())
});
function SelectTabRangeById(id){
//Deselect the previous tab
m_selectedTabs.hide();
//Find the new Tab
m_selectedTabs = $('#' + id).prevAll().andSelf();
//Select it
m_selectedTabs.show();
}
HTML
<span id='tab1'>Week 1</span><span id='tab2'>Week 2</span><span id='tab3'>Week 3</span><span id='tab4'>Week 4</span><span id='tab5'>Week 5</span>
<br/>
<select id="Week" name="Week">
<option value="tab1">1</option>
<option value="tab2">2</option>
<option value="tab3">3</option>
<option value="tab4">4</option>
<option value="tab5">5</option>
</select>
</p>