<button id="thumb" onfocus="focus()" style="height: 12px; width: 12px; background-color: white; border-radius: 50%; margin: 0 auto; position: relative; top: -3px; left: 50%; box-shadow: 0px 0px 3px #888888;">
</button>
函數調用:
function focus() {
document.getElementById('thumb').style.background-color="blue";
}
錯誤:
Uncaught ReferenceError: Invalid left-hand side in assignment
我不理解爲什麼這是一個錯誤。我想這可能是因爲-
這個符號。它適用於其他造型,例如document.getElementById('thumb').style.width="10px"
的作品。