我有這樣的代碼:爲什麼我的選擇onchange不起作用?
<select>
<option onChange="filterProducts(this);">Select ...</option>
<option onChange="filterProducts(this);">Samsung</option>
<option onChange="filterProducts(this);">LG</option>
<option onChange="filterProducts(this);">Sony</option>
<option onChange="filterProducts(this);">Philips</option>
</select>
這應該解僱一個js方法,但它只是不火:
function filterProducts(firedByControl){
alert(fired);
}
對於這個按鈕,調用同一個JS方法,所有的工作很好:
<button type="button" class="btn" onclick="filterProducts(this)" value="LCD">LCD</button>
你能告訴我我錯了嗎?
的平變化必須在''
感謝所有,令人難以置信的多麼容易... –