<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"
的作品。