0
我有一個窗體,使用下拉菜單顯示用戶的窗體的隱藏部分。這是爲了讓乍一看看起來簡單。這裏是網絡地址: http://www.azerventures.com/reservations2.phponClick與下拉菜單不工作在Chrome
我已經在IE和FF中測試過它,它的工作原理與預期的完全一樣,但它不適用於Chrome。我看過很多關於類似問題的文章,但我似乎無法得到修復程序在我的網站上工作。我只是不太瞭解JavaScript。這裏是我的代碼:
<script type="text/javascript" language="javascript">
function Display(which) {
tn=document.getElementById("Tent");
fs=document.getElementById("Fishing");
wl=document.getElementById("Wall");
tr=document.getElementById("Trip");
if (which=='Tent2') tn.style.display="block";
else tn.style.display="none";
if (which=='Fishing2') fs.style.display="block";
else fs.style.display="none";
if (which=='Wall2') wl.style.display="block";
else wl.style.display="none";
if (which=='Trip2') tr.style.display="block";
else tr.style.display="none";
}
</script>
<select style="float: left; margin-bottom: 20px;" name="item1"
onchange="if(this.options[this.selectedIndex].onclick && document.all)
this.options[this.selectedIndex].onclick()">
<option selected>Select An Option</option>
<option name="tent2" onClick="Display('Tent2');">Reserve a Tent</option>
<option name="Fishing2" onClick="Display('Fishing2');">Reserve a Fishing Set</option>
<option name="Wall2" onClick="Display('Wall2');">Rent out the Climbing Wall</option>
<option name="Trip2" onClick="Display('Trip2');">Book a Climbing Trip</option>
</select>
<div name="Tent" id="Tent" style="display: none; margin-bottom: 20px;"></div>
的形式是括號內還有其他div的,我並沒有包括所有爲了便於閱讀。非常感謝你的幫助!