我想改變文本框的值依賴於其他領域,我沒有,但沒有工作,獲得在「resoom」字段爲零,如何取決於其他領域
<script>
function resoome(){
\t var get_balance=document.getElementById("Etisalat").value
\t var alfees;
switch(get_balance){
\t \t case get_balance>=0.5 && get_balance<=1:
\t alfees=0.10;
\t break;
\t case get_balance>1 && get_balance<=3:
\t alfees=0.15;
\t break;
\t case get_balance>3 && get_balance<=5:
\t alfees=0.25;
\t break;
\t case get_balance>5 && get_balance<=10:
\t alfees=0.50;
\t break;
\t case get_balance>10 && get_balance<=15:
\t alfees=0.60;
\t break;
\t case get_balance>15 && get_balance<=20:
\t alfees=0.70;
\t break;
\t case get_balance>20 && get_balance<=30:
\t alfees=0.80;
\t break;
\t case get_balance>30 && get_balance<=40:
\t alfees=0.90;
\t break;
\t case get_balance>40 && get_balance<=70:
\t alfees=1;
\t break;
\t case get_balance>70 && get_balance<=100:
\t alfees=1.25;
\t break;
\t case get_balance>100 && get_balance<=150:
\t alfees=1.50;
\t break;
\t case get_balance>150 && get_balance<=200:
\t alfees=2;
\t break;
\t case get_balance>200:
\t alfees=3;
\t break;
\t default:
alfees=0;
\t \t }
\t \t resoom.value=alfees;
\t \t }
</script>
\t <select name="Etisalat" id="Etisalat" onfocusout="resoome()" class="select Etisalat">
<option value="0.5">0.5</option>
<option value="1">1</option>
<option value="1.5">1.5</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input type="number" id="resoom"style="width:90px" name="resoom" placeholder="الرسوم"/>
我怎樣才能解決這個問題,使resoom值變化取決於其他費爾德 感謝
我相信你的問題可能與你如何閱讀select的價值。嘗試使用此代替:'var get_balance = parseFloat(document.getElementById(「Etisalat」)value);' – BlackPanther