【发布时间】:2020-03-28 08:59:37
【问题描述】:
我需要帮助编写 HTML 代码。我尝试了许多不同的方法来编码这个按钮。该按钮现在在网页上,但不会更改网页的背景颜色。
<html>
<body>
<button type="button" onclick="myFunction()"> Blue</button>
<script>
function myFunction(){
document.getElementByld("background").sytlecolor="blue";
</script>
</body>
</html>
【问题讨论】:
-
欢迎来到 Stack Overflow!
-
这能回答你的问题吗? javascript change background color on click
-
这个问题在 Stackoverflow 上已经有了答案,首先你应该在 Stackoverflow 上谷歌或搜索这里,然后在这里发布一个问题。
-
这能回答你的问题吗? Changing button color programmatically
标签: javascript html