<button onclick="myFunction()">點選我!</button>
<script>
function myFunction() {
let x = document.getElementById("demo");
x.style.fontSize = "25px";
x.style.color = "red";
}
</script>
親自嘗試
如果您想將 W3Schools 服務用於教育機構、團隊或企業,請傳送電子郵件給我們
sales@w3schools.com
如果您想報告錯誤,或想提出建議,請傳送電子郵件給我們
help@w3schools.com