1
現在的問題是創建一個函數showLink()
,它有一個變量sIndx
指向當前選擇列表中所選選項的索引。javascript getElementByTagName
<select name="executive" id="executive" class="optionLinks">
<option value="#">Select a Web site</option
<option value="http://www.whitehouse.gov">The White House</option>
<option value="http://www.usda.gov">Department of Agriculture</option>
</select>
<select name="legislative" id="legislative" class="optionLinks">
<option value="#">Select a Web site</option>
<option value="http://www.house.gov">House Web Site</option>
<option value="http://www.house.gov/house </option>
<option value="http://clerk.house.gov/">Clerk of the House</option>
</select>
<select name="judicial" id="judicial" class="optionLinks">
<option value="#">Select a Web site</option>
<option value="http://www.uscourts.gov">U.S. Courts</option>
<option value="http://www.uscourts.gov/supremecourt.html">U.S.Supreme </select>
我的回答:
function Link() {
sIndex = document.getElementByTagName("select")[this.select].options[selectedIndex];
location.href = sindex.value;
}
的網頁沒有加載,我仍然看到的選項點擊,任何幫助嗎?