我使用以下代码创建一个简单的表单。如何使当有人单击其中一个输入字段时边框改变颜色?提前致谢
<style>
.texta {
color: #CDCBCB;
background-color: #FFFFFF;
border: 1px solid #E2E2E2;
font-style:italic
}
.sendbutton {
background:#F6F6F6; color:#999999;
border: 1px solid #E2E2E2;
cursor:pointer;
padding:5px 10px;
-webkit-border-radius:8px
}
</style>
<form action="mailto:email@email.com" method="post" enctype="text/plain">
<div style="height:12px;"><input type="text" name="name" value="Name (required)" size="40" class="texta"></div><br>
<div style="height:12px;"><input type="text" name="mail" value="Email (required)" size="40" class="texta"></div><br>
<div style="height:12px;"><input type="text" name="comment" value="Subject (required)" size="40" class="texta"></div><br>
<textarea name="Message" value="Message (required)" cols="40" rows="6" class="texta"></textarea><br>
<br><input type="submit" value=" Send " class="sendbutton">
</form>
最佳答案
为 .texta:focus
添加 CSS 规则并设置 border-color
。
关于Javascript 表单 AJAX 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7868136/