2013-07-24 28 views
0

我的2個選擇列表框撰寫:如何觸發動畫時,在列表框中的項目被選中

<table width="auto" height="auto" style="position:relative; top:100px;"> 
     <tr> 
     <td><select name="payment_selection"></td> 
     <td> 
      <option id="sel_cash" value="">Cash - pay in station</option> 
      <option id="sel_account" value="">Customer account</option> 
     </td> 
     </select> 
     </tr> 
    </table> 

當客戶選擇「現金 - 支付站」 這應該在下面顯示:

<td>Total</td> 
    <td><?php //code ?></td> 

當客戶選擇「客戶帳戶」 這應顯示在下方的JavaScript。

<td>Your remaining balance is</td> 
    <td><?php //code ?></td> 

你能給我推薦一個代碼嗎?我只的onclick功能 而不是一個列表框,並選擇知道按鈕。希望標題在我的問題中是正確的。

+0

你選擇的元素被錯誤地嵌套發生什麼。 –

+0

爲什麼你有下降的表降混合..把它在一個囚室 – gezzuzz

回答

0
<table width="auto" height="auto" style="position:relative; top:100px;"> 
     <tr> 
     <td><select onchange="somefunction();" name="payment_selection"></td> 
     <td> 
      <option id="sel_cash" value="">Cash - pay in station</option> 
      <option id="sel_account" value="">Customer account</option> 
     </td> 
     </select> 
     </tr> 
    </table> 
<script> 
function somefunction(){ 
alert("value changed!"); 
} 
</scrip> 

我想你知道將這個

+0

不知道爲什麼,這得到了-1 ..上的變化是什麼,他需要 – gezzuzz

-1

$('#payment_selection').bind({
'change': function(event) {
alert($(this).val());
}
});

+0

這個問題並沒有一個jQuery的解決方案要求。 –

相關問題