我在這裏再次出現問題。如何更改onClick事件上其他按鈕的圖像?
我有四個按鈕,當我點擊按鈕之一時,它將按鈕圖像從舊圖像更改爲新圖像現在,圖像被更改,但如果我按下按鈕2按鈕2的圖像被更改,但按鈕圖像一個是相同的,即新的圖像。我希望它恢復到舊的形象。 這裏是代碼:
<input type="image" id="start" src="buttonred.png" width="50px" height="50px" onClick= "this.src='buttonblue.png'"/>
<input type="image" id="stop" src="buttonred.png" width="50px" height="50px" onClick="this.src='buttonblue.png'"/>
<input type="image" id="slow" img src="buttonred.png" width="50px" height="50px" onClick="this.src='buttonblue.png'"/>
<input type="image" id="fast" img src="buttonred.png" width="50px" height="50px" onClick="this.src='buttonblue.png'"/>
我建議您設置一個功能,將所有te圖像重置爲第一個圖像,並在更改點擊圖像之後。 – J261 2014-10-08 18:39:18