這裏是我的代碼,我希望能夠使用任何用戶輸入作爲我的showColor函數的值。我用document.getElementsByName,但我得到了一些錯誤類型錯誤。有人可以幫忙嗎?謝謝!如何從輸入表單中獲取值,並將其用於我的一個javascript函數中
<input type="text" name="color" value="Input Your Fav Color">
<button type="button" onClick="showColor('red')">Show Color</button>
這個作品完美!謝謝! – sammiwei
不客氣。快樂的編碼! – mrtsherman