【发布时间】:2023-04-07 08:24:02
【问题描述】:
我希望我的按钮在点击时改变颜色 [假设为黑色],但在页面刷新时我不希望它把颜色改回原来的颜色。
<html>
<head>
<style>
.button {
background-color: #4CAF50;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
</style>
</head>
<body>
<h2>CSS Buttons</h2>
<input type="button" class="button" value="Input Button">
</body>
</html>
【问题讨论】:
-
用 JavaScript just 是不可能的。
-
有什么理由不使用 jQuery 吗?使用 jQuery 真的很容易
标签: javascript html css onclick action