我想讓我的選擇只打印一個地址而不是兩個。當我選擇TMobile時,它會很好地完成輸入的打印。但是,如果我也選擇Verizon,它也會在其旁邊添加Verizon地址。
<select class='cellBox' id='cellSelection'>
<option value='@tmomail.next'>TMobile</option>
<option value='@vzwireless.com'>Verizon</option>
</select>
<input type='text' class='histBox' id='resultCell'>
這裏是我的javascript:
var dropdown2 = document.getElementById('cellSelection2');
var textbook2 = document.getElementById('resultCell2');
dropdown2.onchange = function(){
textbook2.value += this.value;
}
你在你的代碼中的語法錯誤。 – lumio
也分享html。 – Difster
那麼,如果你選擇兩個運營商會發生什麼? – lumio