我得到這個代碼放在這裏最近幫助用JavaScript來隱藏單選按鈕
<script type='text/javascript'>
$('#discountselection').hide();
$('#No').click(function(){
$('#discountselection').hide();
});
$('#Yes').click(function(){
$('#discountselection').show();
});
</script>
其目的是隱藏一個下拉框,這取決於是否單選按鈕yes和no選擇。這裏是我的代碼:
<td width="338">Would You like to avail of our multiyear discounts?*
<br />See <a href="Pricing">Pricing</a> for more details
</td>
<td colspan="4">
<input name="discount" type="radio" id="Yes" value="Yes" />Yes
<input name="discount" type="radio" id="No" value="No" checked="checked" />No<br />
<select class="purple" name="discountselection" id="discountselection">
<option value="1" selected="selected">1 Year</option>
<option value="2">2 Years</option>
<option value="3">3 Years</option>
</select>
</td>
我的頭標籤之間放置在JavaScript中,但由於某種原因,這恰恰是不是爲我工作。我根本不熟悉JavaScript。如果有人能夠看到我出錯的地方,這將是一個很大的幫助。 謝謝。
您是否包含jQuery?這個腳本似乎使用它。 – halfdan 2010-09-15 08:59:46
「之間的標籤」是什麼意思?什麼標籤? – annakata 2010-09-15 09:03:45
@ halfdan ..我以爲我的問題已經解決,因爲我忘記了鏈接到jquery文件,但後來我做到了這一點但是它仍然沒有工作。 @annakata - 抱歉,我的意思是標題標籤,由於某種原因,頭部沒有顯示。 – 109221793 2010-09-15 09:05:15